O'Reilly logo

Facelets by Robert Swarr

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 4. Developing and Using Facelets Templates

4.1 What Are Templates?

Achieving a common look and feel is a widely shared goal of web site design. Efforts to achieve this are motivated by practical concerns such as improving the user interface experience and "branding" the site. Another major goal of development organizations is code re-use. This is also motivated by pragmatic concerns. Industry experience demonstrates that improving code re-use reduces development and maintenance costs. Facelets addresses both of these goals.

Facelets is a JSF templating framework that builds a tree of UIComponent objects. These components can be core or custom JSF components, HTML markup tags, or compositions of components. Compositions can be Facelets views that are included in a page (as in Chapter 3. Developing JSF Views with Facelets) or templates (the subject of this chapter). The important point is that Facelets renders this component tree in its entirety in the Render Response phase of the request processing lifecycle. This tight integration with JSF avoids the kind of problems that you see with JSF when you combine JSF components and HTML markup, such as a fieldset tag, where the fieldset is rendered before the components it is supposed to contain.

Facelets is a JSF templating framework with more functionality than JSP static and dynamic includes and with better JSF integration. Chapter 3. Developing JSF Views with Facelets showed you how to create a page layout using Facelets include ...

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