Java Reference
In-Depth Information
<h:body>
<ui:composition template="/template.xhtml">
<ui:define name="content">
<f:view>
<h:form>
...content here
</h:form>
</f:view>
</ui:define>
</ui:composition>
</h:body>
</html>
If more than one template directory resides within an application's contracts directory then the desired
template must be specified using one of a couple techniques. To dynamically or statically specify a view's template
from directly within a view, utilize the new contracts annotation within the <f:view> tag of a view, specifying the
desired template name. The following view demonstrates how to utilize this technique to specify a template named
mocha for the view.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd " >
<html xmlns=" http://www.w3.org/1999/xhtml "
xmlns:f=" http://xmlns.jcp.org/jsf/core "
xmlns:h=" http://xmlns.jcp.org/jsf/html "
xmlns:ui=" http://xmlns.jcp.org/jsf/facelets " >
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Mocha Style</title>
</h:head>
<h:body>
<ui:composition template="/template.xhtml">
<ui:define name="content">
<f:view contracts="mocha">
<h:form>
<p>
<h:commandLink value="Enter flow" action="exampleFlow" />
<br/>
<br/>
<h:commandLink value="Enter flow #2" action="exampleFlow2" />
</p>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</h:body>
</html>
 
Search WWH ::




Custom Search