Check out

http://jakarta.apache.org/struts/userGuide/dev_validator.html

Under "Pluggable Validators" there is a section called "Multi Page Forms".
I've not done this before, but I think this wizard-like functionality you
are trying to build is built directly into Struts and the Validator.

Matt
----- Original Message ----- 
From: "Ruben Carvalho" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 15, 2003 12:19 PM
Subject: One form, multiple JSPs, multiple validations


> Good afternoon helpers,
>
> I've started a new application using struts 1.1 and I'm having some
problems with some new concepts.
>
> I want to use XML form validation (DynaValidatorForm) using
validator-rules.xml and my validaton.xml. Right now my application is
working fine. Now I want to use different validation rules for the same
form, accross multiple JSPs. For example:
>
> - TestForm is a DynaValidatorForm
>   String name
>   String address
>
> - test1.jsp
>   I want to show one text box to fill the "name" property:
>
> (...)
>   <html:text property="name" />
> (...)
>
> - test2.jsp
>   I want to show one text box to fill the "address" property:
>
> (...)
>   <html:text property="address" />
> (...)
>
> - struts-config.xml
> (...)
> <form-beans>
>     <form-bean name="testForm"
type="org.apache.struts.validator.DynaValidatorForm">
>       <form-property name="name" type="java.lang.String"/>
>       <form-property name="address" type="java.lang.String"/>
>     </form-bean>
> </form-beans>
> (...)
>
> - validaton.xml
> (...)
>     <formset>
>         <form name="logonForm">
>             <field property="username" depends="required">
>                 <arg0   key="prompt.username"/>
>             </field>
>             <field property="address" depends="required">
>                 <arg0   key="prompt.address"/>
>             </field>
>         </form>
> </formset>
> (...)
>
> Now, I run http://localhost/app/test1.jsp and I fill in my "name"
property. Then I want my app to validate only the "name" property. Then I
forward to test2.jsp, fill the "address" property and now I want to validate
only the "address" property. How can I do this? The problem is, what
identifies a rule in validation.xml is the form name. I could define
different names for my form in the struts-config.xml but imagine if I had 10
JSPs for each form.
>
> Thanks in advance
>
> Rúben Carvalho
>
>
>
>
>
>


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

Reply via email to