> Would it be possible to have just 1 form with a "type" property and then
> from the JSP's a hidden field that sets the type? Based on this "type"
> you can control the proper validation. Having different classes with
> the same form name could get messy.
>
Do you mean only one class (Form.java) with different validate() methods?
ie., smth like:
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if(type.equals("view1"))
return validateView1();
if(type.equals("view2"))
return validateView2();
//...
return errors;
}
private ActionErrors validateView1() {
...
}
...
I began with smth like this, but I was wondering if there was a better
way, a more generic one which I could config with the struts file ...
>> Hi,
>> I would like to use something like this:
>>
>> <form-bean name="form1" type="com.mycompany.Form1" />
>> <form-bean name="form2" type="com.mycompany.Form2" />
>> <form-bean name="form3" type="com.mycompany.Form3" />
>>
>> with : Form1.java, Form2.java, Form3.java extend Form.java.
>> Form1, Form2 and Form3 have the same properties, but different
>> validate() methods.
>>
>> How to write that all these forms refer the same one.
>> I mean, I would like struts to save these differents form-beans with the
>> same name in session or request scope. Then, I could use the properties
>> set in form1 in the form2 (etc.) (like a wizard)
>>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>