Java Reference
In-Depth Information
As we can see, the template client also uses the xmlns:ui="http://java.sun.com/
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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<body>
<ui:composition template="./template.xhtml">
<ui:define name="top">
<h2>Welcome to our Site</h2>
</ui:define>
<ui:define name="left">
<h3>Links</h3>
 
Search WWH ::




Custom Search