Java Reference
In-Depth Information
to be used along with the template. The template file must be named
template.xhtml
. For instance, to generate a
template named “mocha” for an application, one could construct a hierarchy such as in Figure
2-2
.
Figure 2-2.
Resource Library Contracts Hierarchy
If only one template directory resides within an application's
/contracts
or
/META-INF/contracts
directory,
then that template can be applied to any view within the application by simply referencing the template as
/template.xhtml
within the template annotation of a view. For example, the contents of the
template.xhtml
file
residing within the mocha directory are as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="
http://www.w3.org/1999/xhtml
"
xmlns:ui="
http://xmlns.jcp.org/jsf/facelets
"
xmlns:h="
http://xmlns.jcp.org/jsf/html
"
>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h:outputStylesheet name="layout.css"/>
<title>Introduction to Java EE 7 - Mocha Style</title>
</h:head>
<h:body>
<div id="top">
<h2>Intro to Java EE 7</h2>
</div>
<div>
<div id="left">
<h:form id="navForm">
<h:outputLink value="/IntroToJavaEE7/faces/chapter01/index.xhtml" >
Chapter 1</h:outputLink>
<br/><br/>
<h:outputLink value="/IntroToJavaEE7/faces/chapter02/index.xhtml">
Chapter 2</h:outputLink>
<br/><br/>
<h:outputLink value="/IntroToJavaEE7/faces/chapter03/index.xhtml">
Chapter 3</h:outputLink>
<br/><br/>
<h:outputLink value="/IntroToJavaEE7/faces/chapter04/index.xhtml">
Chapter 4</h:outputLink>