What are JSF Facelets?
Java Server Faces was a new system for component-based UI building, similar to FX’s Scene Builder, but with a strong HTML crossover, debuting around 2005. The system uses custom tags to add power to dynamic web processing. There are three main categories of libraries in JSF.
Core- the core library has some functional elements that help sort and display lists of information. Some of the most frequently used tags include View (form container), listeners, converters, and validators. Often, many of the listeners and reactionary functions in a JSF web app will use the HTML tag library to replace listeners with command buttons [3].
Html – access to most html style elements like input fields, buttons, and tables via the ‘h:’ prefix for JSF custom HTML element names. Almost all of the HTML tags in JSF are able to accept EL expressions. Almost all of the elements come with settable attributes that help processing like binding- attach an element instance to a bean property, or immediate- to ensure something is processed during the apply request values phase rather than the validation phase. Another helpful attribute is id- to set a server-side(java side) reference variable for the element instance [1].
Facelets- a set of tags with pre-fix ‘ui’ that help make UI elements more re-usable. Both elements and entire page structures can be controlled with the addition of this library. [2] Facelets are the MVC- view templates, including element templates, allowing information to be formatted identically but have variable access to content.
All of these powerful libraries allow us to use the more robust format of xhtml to reduce the amount of Java necessary in view files. It simplifies the construction of a well separated MCV architecture. However easy it makes the creation of the view, it makes the setup that much more finicky. Using xhtml has so far yielded unworking examples, however, it can also be used on top of JSP by declaring the tag libraries in that format.
Sources
[1] https://docs.oracle.com/javaee/7/tutorial/jsf-page002.htm
[2]Https://docs.oracle.com/javaee/6/javaserverfaces/2.0/docs/pdldocs/facelets/index.html
[3] https://javabeat.net/introduction-to-jsf-core-tags-library/