Templating is a concept based on code reusability. Templates, or tiles, represent the portions of reusable code that can be puzzled together to obtain JSF pages. In order to accomplish this, we exploit a handful of tags from http://xmlns.jcp.org/jsf/facelets namespace.
Usually, prefixed with ui
, these tags are listed as follows:
The
<ui:composition>
tag (TagHandler
): This defines a page composition that can use a template (any content outside of this tag is ignored). Thetemplate
attribute is optional and is used for indicating a template to which the enclosed content should be applied. Multiple compositions can use the same template, thus encapsulating and reusing the layout. Facelets will paste the enclosed content into the component's hierarchy, usually underUIViewRoot
. The<ui:composition>
tag is used in the following manner:<ui:composition template="template_path">
The
<ui:define>
tag (TagHandler
): This defines the content...