Java Reference
In-Depth Information
footer.xhtml
style.css
logo.png
scripts.js
index.xhtml
...
In addition to the deployment in the
contracts
folder, your templates can be pack-
aged in a JAR file; in this case, they must be stored in the
META-INF
/
contracts
folder of the JAR which will be deployed in the
WEB-INF
/
lib
folder of your applica-
tion.
Once defined, templates must be referenced within an application's
faces-con-
fig.xml
file, with the
resource-library-contracts
element. The configura-
tionsofthefollowingrequestmeanthat
template1
isappliedtopageswhoseURLs
respect the pattern
/templatepages/*
. And for other pages, the
template2
will
be applied.
<resource-library-contracts>
<contract-mapping>
<url-pattern>/templatepages/
*</url-pattern>
<contracts>template1</contracts>
</contract-mapping>
<contract-mapping>
<url-pattern>*</url-pattern>
<contracts>template2</contracts>
</contract-mapping>
</resource-library-contracts>
The following code snippet shows us what the header of
template1
looks like. It
contains only a picture to be displayed in the header. You can add text, style, and
color if you want.