Java Reference
In-Depth Information
The render kit defines a set of
javax.faces.render.Renderer
classes for each
component that it supports. Each
Renderer
class defines a different way to render
the particular component to the output defined by the render kit. For example, a
UISelectOne
component has three different renderers. One of them renders the com-
ponent as a set of radio buttons. Another renders the component as a combo box. The
third one renders the component as a list box. Similarly, a
UICommand
component
can be rendered as a button or a hyperlink, using the
h:commandButton
or
h:commandLink
tag. The
command
part of each tag corresponds to the
UICommand
class, specifying the functionality, which is to fire an action. The
Button
or
Link
part
of each tag corresponds to a separate
Renderer
class that defines how the component
appears on the page.
Each custom tag defined in the standard HTML render kit is composed of the component
functionality (defined in the
UIComponent
class) and the rendering attributes (defined
by the
Renderer
class).
The section “Adding Components to a Page Using HTML Tags” in
The Java EE 6 Tutori-
al: Basic Concepts
lists all supported component tags and illustrates how to use the tags
in an example.
The JavaServer Faces implementation provides a custom tag library for rendering com-
ponents in HTML.
Conversion Model
A JavaServer Faces application can optionally associate a component with server-side ob-
ject data. This object is a JavaBeans component, such as a managed bean. An application
gets and sets the object data for a component by calling the appropriate object properties
for that component.
When a component is bound to an object, the application has two views of the compon-
ent's data:
• The model view, in which data is represented as data types, such as
int
or
long
.
• The presentation view, in which data is represented in a manner that can be read or
modified by the user. For example, a
java.util.Date
might be represented as
a text string in the format
mm/dd/yy
or as a set of three text strings.
The JavaServer Faces implementation automatically converts component data between
these two views when the bean property associated with the component is of one of the
types supported by the component's data. For example, if a
UISelectBoolean
com-
ponent is associated with a bean property of type
java.lang.Boolean
, the JavaServ-
er Faces implementation will automatically convert the component's data from
String