Java Reference
In-Depth Information
When using Facelets templating, if a template client does not override a section
defined on the template, then the template's markup is shown on the rendered page.
This allows us to define, for example, a page header that should be the same across
all pages in our application in one place (the template), rather than redefining it on
every page.
In our example, the top and left sections should be the same across the application.
Therefore, we uncheck these boxes so that those sections are not generated in our
template client.
After clicking on Finish , our template client is created, with the following content:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<body>
<ui:composition template="./template.xhtml">
<ui:define name="content">
content
</ui:define>
</ui:composition>
</body>
</html>
As we can see, the template client also uses the xmlns:ui="http://xmlns.jcp.org/
jsf/facelets" namespace; in a template client, the <ui:composition> tag must be
the parent tag of any other tag belonging to this namespace. Any markup outside this
tag will not be rendered, and the template markup will be rendered instead.
The <ui:define> tag is used to insert markup into a corresponding <ui:insert>
tag in the template. The value of the name attribute in <ui:define> must match the
corresponding <ui:insert> tag in the template.
 
Search WWH ::




Custom Search