user007
user007

Reputation: 29

How to include a xhtml page into a Template in jsf

I am trying to include a xhtml page into a Template content.Such that the content of template may contain the output of that xhtml file. I don't how to include this,so please give me some suggestions.

`index.xhtml

    <ui:composition template="newTemplate.xhtml">
         <ui:define name="content"   ></ui:define></ui:composition>

</h:body>`

newTemplate.xhtml

    <div id="top">
        <ui:insert name="top">Top</ui:insert>
    </div>

    <div id="content" class="center_content">
        <ui:insert name="content">Content</ui:insert>
    </div>

    <div id="bottom">
        <ui:insert name="bottom">Bottom</ui:insert>
    </div>

</h:body>
`

Upvotes: 0

Views: 1853

Answers (1)

Iker Aguayo
Iker Aguayo

Reputation: 4115

Template:

<ui:composition>  
       <ui:insert name="wa_content"></ui:insert>
</ui:composition>

xhtml page (with another include):

<ui:composition template="template_name">

        <ui:define name="wa_content" >
              <ui:define name="buttonsPanelBody" >
                        <ui:include src="other_xhtml_page_name.xhtml" />
              </ui:define>
        </ui:define>
</ui:composition>

other_xhtml_page_name.xhtml

<ui:composition>
         your code
</ui:composition>

Upvotes: 1

Related Questions