You can create handler methods that are associated with a form’s submit button in the same way that form fields are associated with specific properties. Submit handler methods are particularly powerful, because the tags that implement them are processed after tags that use other input types so you can use them to evaluate the form as a whole and take appropriate actions. For example, you might write a handler method called handleRegister, which is invoked when the user clicks the Register Now button created by this tag:

<dsp:input type="submit" value="Register Now" bean="MyFormHandler.register"/>

A form handler can have multiple submit handler methods that each handle form submissions differently. For example, registration, update, and change password forms might use the same form handler, which has three handler methods: handleRegister, handleUpdate, and handleChangePassword. On submission, each form calls the appropriate method. For example, the change password form might contain the following tag for the submit button:

<dsp:input type="submit" value="Change Password" 
Extending handleCancel()

The atg.droplet.GenericFormHandler class (and any subclass of GenericFormHandler you write) includes a handleCancel method for implementing form Cancel buttons. This method redirects to the URL specified in the form handler’s cancelURL property. Typically this property is set to the current page, so clicking Cancel redisplays the form page. If the form handler component is request scoped, this creates a new instance of the form handler object, and reinitializes the form data.

Note: If your form handler component is session scoped (see Form Handler Scope), this reinitialization does not occur. In this case you need to extend the handleCancel method of its class so it resets the appropriate form data. In the following example, the handleCancel method calls a method you wrote that resets the form data:

public boolean handleCancel(DynamoHttpServletRequest pRequest,
               DynamoHttpServletResponse pResponse)
       throws ServletException, IOException
     return super.handleCancel(pRequest, pResponse);