Facelets

The software Facelets is an alternative view handler technology for JavaServer Faces framework. JavaServer Pages is replaced for the definition of the views. Facelets uses as input ahead of valid XML documents. Therefore, the pages in XHTML format are created.

An important feature of Facelets is the so-called component- aliasing. This makes it possible to place the tags for the UI components normal HTML tags, such as to use . The connection to the UI component is JSFC via the alias attribute in the day made ​​. The corresponding component is inserted through Facelets when the page is compiled. The advantage of the component- aliasing is that Web designers can edit the page using conventional HTML editors, since the normal HTML tags are used. The additional attributes for JSF not disturbing them.

Facelets provides many opportunities to compose template fragments to a total page - for example, in order to realize on each side of a single header. Another advantage of Facelets over JavaServer Pages is that expressions in the Expression Language can be placed in the page source outside of tags.

The dependence of XHTML can be represented may also be a disadvantage. When using Facelets you have to be aware that the original markup independence of JSF is lost and alternative renderer for the JSF components (Telnet, etc.) can not be used in conjunction with Facelets.

The Facelets project is Free Software released under the Apache license. Project managers are Jacob Hookom and Roger Kitain who were involved in the Java Specification Request 252 to the version 1.2 of the JavaServer Faces specification.

As part of the development of JavaServer Faces specification version 2.0 in Java Specification Request 314 Facelets has been integrated into the standard specification as the preferred VDL ( View Declaration Language).

Example

The following example shows an XHTML template for Facelets under the use of component- aliasing. The JSFC attribute serves to replace the tag when the page is compiled by the corresponding JavaServer Faces components. It creates a form with a text box and a button for submitting the form. In addition, logged in users are welcomed ( to demonstrate the Unified Expression Language ).

< DOCTYPE html PUBLIC " - / / W3C / / DTD XHTML 1.0 Transitional / / EN " " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >     

                 The above code can be viewed in a browser and manipulated with a HTML designer. With classic JSF pages is not possible, the browser would the JSF elements such as h: output may not represent:

< DOCTYPE html PUBLIC " - / / W3C / / DTD XHTML 1.0 Transitional / / EN " " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >                       Web Links

  • Introduction to Facelets, Oracle (English)
  • Web Development
324212
de