Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts 1.2.7 validation using validwhen

 
dianeb benz
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using struts 1.2.7. According to the documentation, requiredif is deprecated and validwhen should be used instead. I do not get any client-side validation using validwhen. Is there a bug in 1.2.7 or am I missing something? Other validations are working fine (required, mask etc.).

validator-rules.xml:

<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"/>

validation.xml:

<field property="emailAddress" depends="validwhen">
<arg0 key="Email address" resource="false"/>
<var>
<var-name>test</var-name>
<var-value>((sendLetter == null) or (*this* != null))</var-value>
</var>
</field>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic