Subject: DynaValidatorActionForm
From: "Harvey Kandola" <[EMAIL PROTECTED]>
 ===
Struts 1.1-B1
JBoss 2.4.4-Tomcat 3.2.3
JDK 1.3.1
Windows 2K


Can you get the Struts-Validator to validate fields in a Dyna form?  I
appreciate that the "standard" DynaActionForm has no validation method.  But
I am looking at the org.apache.struts.validator package and there appears to
be Dyna-based classes that seem to hook into the validation.xml file.  I
can't get it to work.

Surely you can use org.apache.struts.validator.* classes and attach
validation via the validation.xml file?

Here's my config:

<form-bean name="loginForm" dynamic="true"
type="org.apache.struts.validator.DynaValidatorActionForm">
   <form-property name="firstname" type="java.lang.String"/>
   <form-property name="surname" type="java.lang.String"/>
  </form-bean>

 <action-mappings>
  <action path="/login" type="LoginAction" scope="request" name="loginForm"
validate="true" input="/login.jsp">
   <forward name="Success" path="/main.jsp" redirect="true"/>
   <forward name="Failure" path="/fail.html" redirect="true"/>
  </action>
 </action-mappings>

The validation.xml config is as follows:

<form-validation>
 <global>
 </global>
 <formset>
  <form name="loginForm">
   <field property="firstname" depends="required">
    <arg0 key="firstname.displayname"/>
   </field>
  </form>
 </formset>
</form-validation>

The validator-plug-ing is configured as follows:

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

Thanks.

Harvey.



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to