User Interface Component Classes
JavaServer Faces technology
provides a set of UI component classes and associated behavioral interfaces
that specify all the UI component functionality, such as holding component
state, maintaining a reference to objects, and driving event handling and
rendering for a set of standard components.
The component classes are completely extensible, allowing component
writers to create their own custom components. See Chapter 13, Creating Custom UI Components for an example of a custom image map
All JavaServer Faces UI component
classes extend UIComponentBase, which defines the default
state and behavior of a UI component. The following set of UI component classes
is included with JavaServer Faces technology:
Represents a single column of data in a UIData component.
Represents a control that fires actions when activated.
a data binding to a collection of data represented by a DataModel instance.
a group of controls that submit data to the application. This component is
analogous to the form tag in HTML.
Displays an image.
Takes data input from a user. This class is a subclass of UIOutput.
Displays a localized message.
Displays a set of localized messages.
Displays data output on a page.
Manages the layout of its child components.
Represents substitution parameters.
Allows a user to set a boolean value on a control by selecting
or deselecting it. This class is a subclass of UIInput.
Represents a single item in a set of items.
Represents an entire set of items.
Allows a user to select multiple items from a group of items. This class is
a subclass of UIInput.
Allows a user to select one item from a group of items. This class is a subclass
Represents the root of the component tree.
In addition to extending UIComponentBase, the component classes also implement one or more behavioral
interfaces, each of which defines certain behavior for a set of
components whose classes implement the interface.
These behavioral interfaces are as follows:
ActionSource: Indicates that the component can fire an action event.
This interface is intended for use with components based on JavaServer Faces
technology 1.1_01 and earlier versions.
ActionSource2: Extends ActionSource, and therefore
provides the same functionality. However, it allows components to use the
unified EL when referencing methods that handle action events.
EditableValueHolder: Extends ValueHolder and
specifies additional features for editable components, such as validation
and emitting value-change events.
NamingContainer: Mandates that each component rooted at this component
have a unique ID.
StateHolder: Denotes that a component has state that must be saved
ValueHolder: Indicates that the component maintains a local value
as well as the option of accessing data in the model tier.
UICommand implements ActionSource2 and StateHolder. UIOutput and component classes that
extend UIOutput implement StateHolder and ValueHolder. UIInput and component classes that
extend UIInput implement EditableValueHolder, StateHolder, and ValueHolder. UIComponentBase implements StateHolder. See the JavaServer Faces Technology 1.2 API Specification for
more information on these interfaces.
Only component writers will need to use the component classes and behavioral
interfaces directly. Page authors and application developers will use a standard
UI component by including a tag that represents it on a JSP page. Most of
the components can be rendered in different ways on a page. For example, a UICommand component can be rendered as a button or a hyperlink.
The next section explains how the rendering model works and how page
authors choose how to render the components by selecting the appropriate tags.