Chapter 1. Introducing Facelets: A Better JSF ViewHandler

1.1 What Is Facelets?

Facelets is a Java Server Faces templating framework, based on a few simple principles: creating a tree of UIComponent objects and interweaving content completely within the JavaServer Faces request processing lifecycle. In addition to being totally JSF-centric, it incorporates numerous developer-friendly features. It supports reusable templates that weave in template client or default content. It provides a view compiler that processes all Faces and HTML tags as full members of the UIComponent tree. It enables creation of reusable components without writing a single line of Java code. It supports coding JSF components as "jsfc" attributes, allowing the view files to be created with any web development tool. It eliminates marker tags such as f:view and f:subview, which do not represent presentation components, but instead mediate the technology gap between JSP and JSF. Finally, it composes and renders components completely within the JSF lifecycle. Jacob Hookom, the creator of Facelets, references these simple founding principles in the Facelets Developer Documentation:

Facelets is founded on simple principles and the API is a solid reflection of it. The framework is focused on one specific task, and that's tree creation and content interweaving—taking an XHTML or XML document and using it as a set of instructions to populate a tree of UIComponents.

His statement references the three core ideas around which ...

Get Facelets 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.