validation.xml 内容如下
<formset>
<form name= "registerForm ">
<field property= "name "
depends= "required,minlength ">
<arg0 key= "registrationForm.firstname.displayname "/>
<arg1 name= "minlength " key= "${var:minlength} " resource= "false "/>
<var>
<var-name> minlength </var-name>
<var-value> 5 </var-value>
</var>
</field>
<field property= "email "
depends= "required,email "
page= "2 ">
<arg0 key= "registrationForm.email.displayname "/>
</field>
</form>
</formset>
属性文件加入了相应的KEY,struts文件也做了相当的配置.当执行form的validate方法时就报以下错误.
2007/05/10 11:09:49 org.apache.struts.validator.ValidatorForm validate
致命的: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
org.apache.commons.validator.ValidatorException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
at org.apache.commons.validator.ValidatorAction.loadValidationMethod(ValidatorAction.java:627)
at org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:557)
at org.apache.commons.validator.Field.validateForRule(Field.java:827)
at org.apache.commons.validator.Field.validate(Field.java:906)