Java Reference
In-Depth Information
As we can see, the template client also uses the xmlns:ui="
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; 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.
After deploying our application, we can see templating in action by pointing the
browser to our template client URL.
Notice that NetBeans generated a template that allows us to create a fairly elegant
page with very little effort on our part. Of course, we should replace the markup in
the <ui:define> tags to suit our needs.
Here is a modified version of our template, adding markup to be rendered in the
corresponding places in the template:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns=""
<ui:composition template="./template.xhtml">
<ui:define name="top">
<h2>Welcome to our Site</h2>
<ui:define name="left">
Search WWH ::

Custom Search