1

I am in beginner stage.

I have a doubt like,is it possible to use h:head in a page which is included in another page that also contains h:head?

I already tried but updating is not working fine, that's why I got this confusion.

Sample code:

page1.xhtml

<h:head>
   ......
</h:head>
<h:body>
    <p:panel>
    .....
    </p:panel>  
</h:body>

page2.xhtml

<h:head>
   .....
</h:head>
<h:body>
    <p:panel>
     <ui:include src="page1.xhtml"/>
    </p:panel>
</h:body>

If it is not possible means what error will become?

  • What is the usecase? – Kukeltje May 21 '15 at 10:50
  • I used h: head in above two pages and when make trigger in page2.xhtml then the trigger is not working fine, that's why. after removing the h: head of page2.xhtml then it works fine. –  May 21 '15 at 13:35

1 Answers1

2

There is no possibility to do that, but always you can create a template which will allow to add additional includes inside head tag.

You can do it in that way:

page2.xhtml

      ...
            <h:head>
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    <meta http-equiv="X-UA-Compatible" content="IE=9" />
                    <ui:insert name="additionalIncludes"></ui:insert>
            <h:head>
            <h:body>
                <ui:insert name="content"/>
            </body>
    ...

page1.xhtml

<ui:composition template="page2.xhtml">

    <ui:define name="additionalIncludes">
    // includes
    </ui:define>

   <ui:define name="content">
//content of page1
</ui:define>

</ui:composition>

The page2.xhtml will be a template for page1.xhtml.

sQer
  • 1,136
  • 8
  • 9