I have created a new project using Struts 1.2. When I try to validate a simple login page, I get the following error:
ERROR [Validator] reflection: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest)
java.lang.NoSuchMethodException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest)
at java.lang.Class.getMethod(Class.java:1581)
My validation.xml is:
<!DOCTYPE form-validation PUBLIC “-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN”
“http://jakarta.apache.org/commons/dtds/validator_1_0.dtd”>
<form-validation>
<formset>
<form name=”loginForm”>
<field property=”userid” depends=”required”>
<arg0 key=”User ID” resource=”false” />
</field>
<field property=”password” depends=”required”>
<arg0 key=”Password” resource=”false” />
</field>
</form>
</formset>
</form-validation>
Login Form is a DynaValidatorForm
<!DOCTYPE form-validation PUBLIC “-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN”
“http://jakarta.apache.org/commons/dtds/validator_1_0.dtd”>
<form-validation>
<formset>
<form name=”loginForm”>
<field property=”userid” depends=”required”>
<arg0 key=”User ID” resource=”false” />
</field>
<field property=”password” depends=”required”>
<arg0 key=”Password” resource=”false” />
</field>
</form>
</formset>
</form-validation>
The function works OK, and the user is thrown back to the Login Screen when no values are entered, but the exception is always thrown.
Can you please point me in the right direction.
I am using:
Version: 5.1.0 GA
Build id: 20061111-5.1.0-GA
Java jdk1.5.0_09