Learn Java for Web Development

(Tina Meador) #1

266 CHAPTER 6: Component-Based Web Development Using JSF 2


UI Component

JSF has a rich component model provided in a standard UI component framework, as illustrated in
Figure 6-2. The JSF component model includes the following:


   A rendering model that defines a myriad of forms in which the component can
be rendered such as for desktop application devices and mobile app devices
 An event and event listener model that define how to handle component events
 A conversion model that defines the ways to register data converters to a
component for data conversion
 A validation model that defines the ways to register validators to a component
for the server-side validation

Model

UIComponent

Validator Converter

Renderer EventListenerEvent and
has

has

has

has

binding Navigation

Figure 6-2. The JSF component model


The UI component model is the core of JSF; it allows you to develop the view of a web application
from collections of standard, out-of-the-box UI components. These UI components are responsible
for the behavior and are utilized in the JSF pages by including four tag libraries provided by JSF,
depending on the type of UI component you want to use.


Renderer

The renderer is responsible for displaying a component, in other words, rendering the markup to
the client and translating a user’s input into the component’s value. JSF supports two programming
models for displaying components.


   Direct renderer model: When the direct model is used, components decode
from, and encode to, the view. The decoding and encoding processes are
explained in the next section.
 Delegated renderer model: When the delegated model is used, the decoding
and encoding are delegated to a renderer.
Free download pdf