Wiki

Clone wiki

Oracle JSF Expert 1Z0-896 / Implement templates

Template

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title><ui:insert name="windowTitle"/></title>
    </h:head>
    <h:body>
        <div id="heading">
            <ui:insert name="heading">
                <ui:include src="/heading.xhtml"/>
            </ui:insert>
        </div>
        <div id="content">
            <ui:insert name="content"/>
        </div>
    </h:body>
</html>

ui:composition

Everything outside of ui:composition is excluded from rendering

<ui:composition template="mytemplate.xhtml">
    <ui:define name="windowTitle">
        Window Title!
    </ui:define>
    <ui:define name="heading">
        Page heading
    </ui:define>
    <ui:define name="content">
        Page content
    </ui:define>
</ui:composition>

ui:decorate

Everything outside of ui:decorate is included in rendering

<ui:decorate template="mytemplate.xhtml">
    <ui:define name="windowTitle">
        Window Title!
    </ui:define>
    <ui:define name="heading">
        Page heading
    </ui:define>
    <ui:define name="content">
        Page content
    </ui:define>
</ui:decorate>

Updated