O'Reilly logo

JavaServer Faces by Hans Bergsten

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Developing Custom Components

In the previous chapter, we looked at how a custom renderer can be developed for an existing component to change how the component is represented and how the user can enter a value for it. A custom renderer is often all that's needed to get the customized behavior you want for your application, but occasionally you must also develop a custom component. Before you do, remember to look to see if someone else has already developed what you need, for instance among the resources listed at http://java.sun.com/j2ee/javaserverfaces.

If you can't find an existing component that fits your needs, this chapter describes how to develop a custom component, either by extending an existing standard component or developing a brand new component type.

Extending an Existing Component

The preferences screens for the sample application we developed in Chapter 9 are not all that user friendly. For instance, you can see the different setting only by navigating through the screens in a fixed order; you can't jump simply from one setting to another. This type of data is better presented as tabs on one screen, as shown in Figure 14-1.

User preferences as tabs

Figure 14-1. User preferences as tabs

Much of what is needed for this design can be done with existing components. The contents of each tab can be represented by a panel component, e.g., with the <h:panelGroup> or <h:panelGrid> action elements. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required