5 Replies Latest reply: Jul 25, 2008 6:45 AM by 843844 RSS

    problem with ActionMessages in struts validator

    843844
      hello, I am developing an application web with struts and I have the following problem:

      org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object,
      org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages,
      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.ActionMessages, 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)
      at org.apache.commons.validator.Form.validate(Form.java:174)
      at org.apache.commons.validator.Validator.validate(Validator.java:367)
      at org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:110)
      at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:927)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
      at java.lang.Thread.run(Thread.java:595)



      the struts version is 1.2.9 and tomcat 5.0 (I have already proven other versions and he/she gives me the same error)

      struts-config.xml:

      ...

      <form-beans>
           <form-bean name="loginForm"
      type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="loginName" type="java.lang.String"/>
      <form-property name="password" type="java.lang.String"/>
      <form-property name="rememberMyPassword" type="java.lang.Boolean"/>
      </form-bean>
      ...
      </form-beans>

      ...

      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
      <set-property property="pathnames"
      value="/WEB-INF/validator-rules.xml,
      /WEB-INF/validation.xml"/>
      </plug-in>
      ...


      and the validation.xml is:

      <formset>

      <form name="loginForm">
      <field property="loginName" depends="required">
           <arg0 key="UserProfile.loginName"/>
      </field>
      <field property="password" depends="required">
           
      <arg0 key="UserProfile.password"/>
      </field>
      </form>

      ...

      </formset>


      Please, can somebody help me??