Christian Billen wrote:
> Hi list,
>
> Is there a way to prevent the reset() method from being called on the
> ActionForm when the validate option in struts-config for that mapping is set
> to false?
>
Doing this would break the recommended approach for dealing with checkboxes,
which rely on reset() being called to reset the corresponding booleans to
false. You will want this to occur even if you are not validating, so that the
bean properties correctly reflect what the user last entered.
>
> My problem is that I have an Action to prepare the data for a jsp page and
> another Action to process the data from that jsp. Both point to the same
> ActionForm class.
> In my prep action (/prepare.do), I configured the mapping not to validate
> the form, but still I see that the reset() method is being called, very
> annoying considering that some properties in my actionform are set to a
> default in the constructor (like a checkbox set to true) and that I have
> code in reset of the same form to clear checkboxes. Shouldn't reset be
> called by the controller only when validate is true?
>
The Struts example application faces a similar situation. In the
EditSubscriptionAction, it creates a new form bean (initialized to defaults in
the constructor) and *replaces* the one that was created by the controller
servlet (and on which reset() was called). You might consider using a similar
technique.
Craig McClanahan
>
> Thanks for your advise,
>
> Christian Billen