The Java EE 5 Tutorial

Adding a Form Component

A UIForm component class represents an input form, which includes child components that contain data that is either presented to the user or submitted with the form.

Figure 11–1 shows a typical login form, in which a user enters a user name and password, and submits the form by clicking the Login button.

Figure 11–1 A Typical Form

Screen capture of form with User Name and Password text
fields and a Login button.

The form tag represents the UIForm component on the page and encloses all the components that display or collect data from the user, as shown here:

... other JavaServer Faces tags and other content...

The form tag can also include HTML markup to lay out the components on the page. The form tag itself does not perform any layout; its purpose is to collect data and to declare attributes that can be used by other components in the form. A page can include multiple form tags, but only the values from the form that the user submits will be included in the postback.