Struts validator isn't validating my form

From: Chad Rosen (chadrosen_at_hotmail.com)
Date: 03/30/04


Date: 30 Mar 2004 10:24:45 -0800

Hi all,

I've been searching through the groups on this subject and so far
haven't found anyone with the same problem so I figured I'd post..

In general my problem is that I cannot get the dynaValidatorForm form
to validate at all. I think I've setup stuff correctly but when I
enter an invalid result in the jsp form the form is either validated
correctly or not at all causing the successful forward to take place
and not the forward back to the form.

Here are some snippets from my code..

JSP:

<html:errors/><br>
<table width="100%" border="1">
  <html:form action="testPost.do" method="POST">
  <tr>
    <td colspan="2">validate me</td>
  </tr>
  <tr>
    <td>email</td>
    <td><html:text property="email"/></td>
  </tr>
  <tr>
    <td colspan="2"><html:submit property="submit"/></td>
  </tr>
  </html:form>
</table>

Form bean:

<form-bean
  name="validateMe"
  type="org.apache.struts.validator.DynaValidatorForm">
  <form-property
   name="email"
   initial="chad"
   type="java.lang.String" />
</form-bean>

Validator.xml:

<form-validation>
<formset>
 <form name="validateMe"
  <field
   property="email"
   depends="required,email">
  </field>
 </form>
</formset>
</form-validation>

Struts config:

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

Other:

I've made sure that Struts works successfully. I've also done
validation in the past with form bean classes. I have the
commons-validator and jakarta-oro libs and the
validator.xml,validator-rules.xml, and both of their dtds are in the
correct places. I've tried switching from a DynaValidatorForm to a
DynaValidatorActionForm and switching the validator.xml to validate
the postAction instead of the form bean name.

Thanks for the help!