Thanks for the responses guys! Please see end of message for follow up question :)

So I get most of what you said about overriding the ActionForm. Since I am using DynaValidatorForm I will need to extend that class.
Currently my form-bean definition is as follows
<form-bean name="userForm" type="org.apache.struts.validator.DynaValidatorForm">
           <form-property name="user" type="com.cwsi.eshipper.model.User"/>
<form-property name="restrictions" type="com.cwsi.eshipper.model.UserRestrictions"/> <form-property name="customer" type="com.cwsi.eshipper.model.Customer"/> <form-property name="creditcard" type="com.cwsi.eshipper.model.CreditCard"/>
       </form-bean>

That would change to

<form-bean name="userForm" type="com.mycompany.mydomain.form.ExtendedDynaValidatorForm">
           <form-property name="user" type="com.cwsi.eshipper.model.User"/>
<form-property name="restrictions" type="com.cwsi.eshipper.model.UserRestrictions"/> <form-property name="customer" type="com.cwsi.eshipper.model.Customer"/> <form-property name="creditcard" type="com.cwsi.eshipper.model.CreditCard"/>
       </form-bean>

and in ExtendedDynaValidatorForm I would have a reset() method as follows

public void reset(ActionMapping mapping, HttpServletRequest request){
   super.reset();
   //not sure what goes here
}

So my next question is..how to I reset all the booleans in the form? Do I have to explicitly reset each of them, or is there a generic way to iterate through all of them and reset them? If possible, can I see some sample code please?

Thanks again!

-Riz.

Rick Reumann wrote:
王曾wang_zeng wrote:
The reason is that the form bean is configed to be saved in session scope,
and the reset() method is not called when the form is submitted.

Rizwan,

Meaning... you need to override the ActionForm reset method and set any of your ActionForm booleans to false. Then you'll be all set. (Remember in http, only true checkboxes values are sent with the Request so if your backing ActionForm has session scope and some were already true, there is nothing to set it to false - which is why you need the reset method for session-scoped form beans and boolean values.



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

Reply via email to