Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Validation Framework ValidatorAction validWhen not found (struts app)

Avatar of epawlik
epawlik asked on
JSP
2 Comments1 Solution2189 ViewsLast Modified:
Hi.

Got a problem with my Validation Framework in my Struts app (version 1.2.9.)

All my other app Validation Framework form field validation works perfectly - depends,required,max,date etc.

But 'validWhen' will not play ball.

In validator-rules the following entry exists:

       <validator name="validwhen"
             msg="errors.required"
             classname="org.apache.struts.validator.validwhen.ValidWhen"
                 method="validateValidWhen"
                 methodParams="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"/>

In validation the following entry exits:

            <field property="homeTelephone" depends="validWhen">
               <arg key="form.label.homeTelephone" position="0"/>
               <var>
                  <var-name>test</var-name>
                  <var-value>(otherTelepone != null) or ((otherTelepone == null) and (*this* != null))</var-value>
               </var>              
            </field>    
                     
            <field property="otherTelephone" depends="validWhen">
               <arg key="form.label.otherTelephone" position="0"/>
               <var>
                  <var-name>test</var-name>
                  <var-value>(homeTelepone != null) or ((homeTelepone == null) and (*this* != null))</var-value>
               </var>              
            </field>  

Stack trace when the form is submitted:

ERROR: [2006-12-03 11:09:17,734] DynaValidatorForm - No ValidatorAction named validWhen found for field homeTelephone
org.apache.commons.validator.ValidatorException: No ValidatorAction named validWhen found for field homeTelephone
      at org.apache.commons.validator.Field.handleMissingAction(Field.java:927)
      at org.apache.commons.validator.Field.validate(Field.java:902)
      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:950)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:207)
      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:709)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Thread.java:595)

Thank you for any pointers.
ASKER CERTIFIED SOLUTION
Avatar of Peter Kwan
Peter KwanFlag of Hong Kong imageAnalyst Programmer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers