Chapter 13. Developing Custom Renderers and Other Pluggable Classes

The JSF specification includes the basic components most applications need: simple input and output, selection lists, menus and checkboxes, links and buttons, a data grid, and panels for layout. When the provided set of components isn’t enough, I recommend that you first look around to see if someone else has developed the component you need. At the time of this writing there are already open source components for the Proposed Final Draft specification version, and when the final specification version is released and JSF gains in popularity, I’m sure there will be plenty of both free and commercial components to pick from. Keep an eye on Sun’s JSF site at http://java.sun.com/j2ee/javaserverfaces for references to ready-made components.

If you can’t find what you’re looking for, you need to roll up your sleeves and develop your own components. As you probably recall, JSF uses separate classes for a component’s behavior and for component rendering. The component classes implement render-independent behavior, such as pushing and pulling the component value to and from a model property, validating an input value, and firing events. The standard components delegate the tasks of generating content to represent the component in a form suitable for a client device (e.g., as HTML elements for a browser) and figuring out how to decode the request data to get the submitted value for the component to a renderer.

In many cases, ...

Get JavaServer Faces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.