A simple read of the Javadoc explains it, and the source shows it:

    /**
     * Reset all bean properties to their default state.  This method is
     * called before the properties are repopulated by the controller
servlet.
     * <p>

If you want to see where exactly, you could grep the source code for
calls to reset(). I think you'll find it in the action servlet (at least
on 1.0 you will - may be elsewhere in 1.1). 

If you want to know why its done where it is, think about properties
that are based on checkboxes where the unchecked options are never sent
over HTTP Post to the server. You would want to reset those flags in the
reset() method to false before the bean utils populate your properties
in your ActionForm to ensure your action form bean's state is valid.
Otherwise, session scoped beans who had their values set to true in the
past will never get reset to false, as the checkbox never sends a value
to the server if it is in the unchecked state. Course, there may be
other reasons as well...

HTH,
James

> -----Original Message-----
> From: Howard Miller [mailto:[EMAIL PROTECTED]] 
> Sent: Saturday, October 12, 2002 7:09 AM
> To: [EMAIL PROTECTED]
> Subject: When *exactly* does reset get called?
> 
> 
> Hi,
> 
> Can soebody explain when the reset method of ActionForm gets called?
> 
> My problem is that I am using the method to prepopulate the 
> form (which works). The 
> previous jsp had a link to the following jsp (the jsp not its 
> action - .jsp not .do, ok). 
> The reset obviously runs and the preloaded values appear.
> 
> When I submit the form, the reset method appears to get 
> called again, so I lose my 
> user entered values. Not wat I expected. And yes the 
> <html.form> tag does point to 
> the .do action.
> 
> Confused.... very!
> 
> HM
> 
> --
> To unsubscribe, e-mail:   
> <mailto:struts-user-> [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]>

Reply via email to