Stable release |
2.0 / June 28, 2009
|
---|---|
Written in | Java |
Operating system | Cross-platform |
Type | Web template system |
Website | facelets |
Stable release |
1.1.15 / November 24, 2009
|
---|---|
Preview release |
1.2-dev / November 10, 2006
|
Written in | Java |
Operating system | Cross-platform |
Size | 5.07 MB (archived) |
Type | Web template system |
License | Apache License 2.0 |
Website | http://facelets.java.net/ |
In computing, Facelets is an open-source Web template system under the Apache license and the default view handler technology (aka view declaration language) for JavaServer Faces (JSF). The language requires valid input XML documents to work. Facelets supports all of the JSF UI components and focuses completely on building the JSF component tree, reflecting the view for a JSF application.
Although both JSP and JSF technologies have been improved to work better together, Facelets eliminates the issues noted in Hans Bergsten's article "Improving JSF by Dumping JSP"
Facelets draws on some of the ideas from Apache Tapestry, and is similar enough to draw comparison. The project is conceptually similar to Tapestry's, which treats blocks of HTML elements as framework components backed by Java classes. Facelets also has some similarities to the Apache Tiles framework with respect to support templating as well as composition.
Facelets was originally created by Jacob Hookom in 2005 as a separate, alternative view declaration language for JSF 1.1 and JSF 1.2 that both used JSP as the default view declaration language. Starting from JSF 2.0, Facelets has been promoted by the JSF expert group to be the default view declaration language. JSP has been deprecated as a legacy fall back.
In Facelets, templates tags from a tag library can be entered in two forms: directly as a qualified xml
element or indirectly via the jsfc
attribute on an arbitrary non-qualified element. In the latter case the Facelet compiler will ignore the actual element and will process the element as-if it was the one given by the jsfc
attribute.
The following example shows the direct usage of qualified tags:
Using the jsfc
attribute, the same code can also be expressed as the example given below:
The above code can be viewed in a browser, and edited with conventional WYSIWYG design tools. This is not possible when directly using the qualified tags. Nevertheless, directly using qualified tags is the most popular way of using Facelets in practice and is the style most used in books and examples.