Perhaps a
word about the reset() method is in order here. In the struts architecture, here is the sequence of events when a user fills out a form and presses the submit button:
The html request is submitted to the serverThe Struts ActionServlet is calledActionServlet either instantiates a new ActionForm or retrieves it from the session scope, depending on the scope you defined.ActionServlet invokes the reset() method on the ActionFormActionServlet populates the properties of ActionForm based on the parameters passed in the request object.ActionServlet calls validate()ActionServlet determines which Action class to call based on the information in struts-config.xml, instantiates the class, and calls it's execute() methodThe Execute method does it's work and returns an ActionForward object to ActionServlet, which then forwards to the appropriate JSP. The need for the reset() method exists because html check boxes and radio buttons don't return a value if unchecked. That means that if the property in your ActionForm is "Y", and you uncheck the box, there is no parameter passed in the request to cause another value other than "Y" to be placed in the property, so it remains unchanged. This is not what you want.
To solve this problem, the reset() method allows youto place the value you want in the property if the check box is unchecked. From the sequence of events above, you can see that this will cause the value to be set before the properties are populated. Therefore, if parameter value for this property is not sent, this property will remain in it's unchecked state. If the parameter is sent due to the check box being checked, the property will have it's checked value.
If the ActionForm is in request scope, the ActionForm will be instantiated by ActionServlet each time a request is submitted. However, if the check box is unchecked, the setter for the property will not get called, and the property will be null. Since the desired state for unchecked is "", you still need the reset() method even in request scope.
I hope this clarifies things.