Form handlers evaluate the validity of form data before it is submitted, check for errors, and determine what action to take—for example, submit the data, direct the user to a different page, and display an error message. Often when you use a form handler, the form input fields are associated with properties of the form handler rather than the component you ultimately want to modify. For example, your form might include this tag:

<dsp:input type="text" bean="MyFormHandler.age"/>

When the form is submitted, a method of MyFormHandler associated with the age property is invoked. Depending on how this method is written, it might validate the data and then set the value of Person1.age, or use the data to fill in a record in a database.

A form handler class must include one or more handler methods. A handler method is typically invoked when the user clicks the submit button, and handles the processing of the form. Depending on the purpose of the form handler, it can have several different handler methods that each perform a different operation. For example, a form handler that works with user profiles might have separate handler methods for creating the profile, modifying the profile, and logging the user in.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices