日期:2014-05-18  浏览次数:20721 次

关于validator验证的问题
抛出如下异常:
java.lang.IllegalArgumentException:   Resources   cannot   be   null.
org.apache.commons.validator.Validator. <init> (Validator.java:188)
org.apache.struts.validator.Resources.initValidator(Resources.java:475)
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:104)
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:928)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

我的struts-config.xml如下:


<struts-config>
  <form-beans>
  <form-bean   name= "registerForm "   type= "org.apache.struts.validator.DynaValidatorForm ">

  <form-property   name= "name "   type= "java.lang.String "/>
  <forn-property   name= "email "   type= "java.lang.String "/>
 
  </form-bean>
  </form-beans>
  <action-mappings>
  <action   path= "/validate "  
                      type= "com.yourcompany.struts.Register "
                      name= "registerForm "  
                      scope= "request "
                      validate= "true "
                      input= "/MyHtml.html ">
                      <forward   name= "success "   path= "/success.jsp "/>
  </action>
  </action-mappings>
    <message-resources   parameter= "com.yourcompany.struts.ApplicationResources "   />
    <plug-in   className= "org.apache.struts.validator.ValidatorPlugIn ">
    <set-Property   property= "pathnames "
    value= "/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml "/>
    </plug-in>
</struts-config>
我的validation.xml如下:
<?xml   version= "1.0 "   encoding= "UTF-8 "?>
<form-validation>
<formset>
<form   name= "registerForm ">
<filed
property= "name "
depends= "required,minlength ">
<args0   name= "minlength "   key= "${var:minlength} "   resource= "false "/>
<var>
<var-name> minlength </var-name>
<var-value> 7 </var-value>
</var>
</filed>
<field  
property= "email "
depends= "required,minlength,eamil "
>
</field>
</form>
</formset>
</form-validation>
请问是什么错误!!


<