Yansheng Lin wrote:

Yes, it would be StrutsValidatorUtil now.

It's part of struts util package. org.apache.struts.util?
Weird, works fine for me just now.  I am using struts-1.1-RC1.


StrutsValidatorUtil was deprecated in struts 1.1, and removed in Struts 1.2. It would be better to use o.a.s.validator.Resources instead for all new code.

-Rob




-----Original Message-----
From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED] Sent: August 1, 2003 1:35 PM
To: 'Struts Users Mailing List'
Subject: RE: NoSuchMethodException



I just looked at the API, and the ValidatorUtil class doesn't have a getActionError method. Do you mean the StrutsValidatorUtil class? I tried that but it didn't like the import. :-(



-----Original Message-----
From: Yansheng Lin [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 3:24 PM
To: 'Struts Users Mailing List'
Subject: RE: NoSuchMethodException


I can see there are several issues here. First I think you might want to
supply
the ServletContext as well. Second, you want to add the error to Errors
collection by adding:
errors.add(field.getKey(),
ValidatorUtil.getActionError(servletContext,
request, va, field));
before the return statement.


Try it. I spent a lot of time before on this too.


-----Original Message-----
From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED] Sent: August 1, 2003 10:40 AM
To: Struts (E-mail)
Subject: NoSuchMethodException



Hey everyone, I'm working on a custom validator right now, and all the validation method does is return false. That means it fails that validation, right? Anyway, when I submit the form, I get a NoSuchMethod error. What would cause this? All of my regular validations work, just not this custom one. Here are some code snippets. Thanks in advance for any help!

public class CustomValidator implements Serializable {
public static boolean validateRange(Object bean, ValidatorAction va,


                                        Field field, ActionErrors errors,
HttpServletRequest request)
        {
                return false;
        }
}


validator-rules.xml:


<!-- Custom Validators -->
<validator name="validRange"
classname="com.moog.us.app.ans.validation.CustomValidator"
method="validateRange"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest,
javax.servlet.ServletContext"
msg="errors.invalid.range">
</validator>



And parts of my validation.xml:


<global>

</global>

                <form name="/AddAssignment">
                        <field       property="startRange"
                                        depends="required">
                                        <arg0 key="app.label.startRange"/>
                        </field>
                        <field       property="endRange"
                                        depends="validRange">
                        </field>
                </form>




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]







--
-----
Rob Leland (703-525-3580)


Choose a job you love, and you will never have to work a day of your life. -Confucius.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to