Pro JSF and Ajax
Let's now look at the different pieces making up a JSF component.
UIComponent
The foundations of all JSF components are the abstract UIComponent and UIComponentBase
classes. The UIComponent class (javax.faces.component.UIComponent) defines the behavioral
agreement and state information for all components, and the UIComponentBase class (javax.
faces.component.UIComponentBase
) is a convenience subclass that implements almost all
methods of the UIComponent class. A simplified description of a UIComponent is that it is a
regular JavaBean with properties, events, and listeners.
The JSF specification defines a set of standard UIComponent subclasses, or behavioral super-
classes (for example, UISelectOne and UISelectMany), which all extend the UIComponentBase
class. In most cases, component writers will extend these standard UIComponent subclasses.
However, they can subclass the UIComponentBase class as well. A JSF component consists of
a UIComponent and one or more Renderers. It is important to understand that the standard
UIComponent
subclasses define only non-renderer-specific behaviors, such as UISelectOne.
Table 1-3 gives an overview of the available standard behavioral UIComponents and lists their
associated convenience subclasses, renderer types, and JSP tags.
Table 1-3.
Components Provided by the JSF Implementation*
UI Component
Renderer-Specific Class
Renderer Type
Syntax/JSP Tag
UIColumn
null
**
<h:column>
UICommand
HtmlCommandButton
Button
<h:commandButton>
HtmlCommandLink
Link
<h:commandLink>
UIData
HtmlDataTable
Table
<h:dataTable>
UIForm
HtmlForm
Form
<h:form>
UIGraphic
HtmlGraphicImage
Image
<h:graphicImage>
UIInput
HtmlInputHidden
Hidden
<h:inputHidden>
HtmlInputSecret
Secret
<h:inputSecret>
HtmlInputText
Text
<h:inputText>
HtmlInputTextArea
Textarea
<h:inputTextarea>
UIMessage
HtmlMessage
Message
<h:message>
UIMessages
HtmlMessages
Messages
<h:messages>
UIOutput
HtmlOutputFormat
Format
<h:outputFormat>
HtmlOutputLabel
Label
<h:outputLabel>
Continued
C H A P T E R 1
s
T H E F O U N D AT I O N O F J S F : C O M P O N E N T S
15