Java Reference
In-Depth Information
• “ Binding Component Values and Instances to Managed Bean Properties on page
133
• “ Binding Converters, Listeners, and Validators to Managed Bean Properties ” on
page 138
Determining Whether You Need a Custom Component or Renderer
The JavaServer Faces implementation supports a very basic set of components and associ-
ated renderers. This section helps you to decide whether you can use standard components
and renderers in your application or need a custom component or custom renderer.
When to Use a Custom Component
A component class defines the state and behavior of a UI component. This behavior in-
cludes converting the value of a component to the appropriate markup, queuing events on
components, performing validation, and any other behavior related to how the component
interacts with the browser and the request processing lifecycle.
You need to create a custom component in the following situations:
• You need to add new behavior to a standard component, such as generating an
additional type of event (for example, notifying another part of the page that
something changed in this component as a result of user interaction).
• You need to take a different action in the request processing of the value of a com-
ponent from what is available in any of the existing standard components.
• You want to take advantage of an HTML capability offered by your target browser,
but none of the standard JavaServer Faces components take advantage of the cap-
ability in the way you want, if at all. The current release does not contain standard
components for complex HTML components, such as frames; however, because
of the extensibility of the component architecture, you can use JavaServer Faces
technology to create components like these. The Duke's Bookstore case study cre-
ates custom components that correspond to the HTML map and area tags.
• You need to render to a non-HTML client that requires extra components not sup-
ported by HTML. Eventually, the standard HTML render kit will provide support
for all standard HTML components. However, if you are rendering to a different
client, such as a phone, you might need to create custom components to represent
the controls uniquely supported by the client. For example, some component ar-
chitectures for wireless clients include support for tickers and progress bars, which
are not available on an HTML client. In this case, you might also need a custom
renderer along with the component; or you might need only a custom renderer.
Search WWH ::




Custom Search