I got a MainPage.xhtml
which includes a lot of other xhtmls like:
<ui:include src="/pages/includes/included1.xhtml"
id="included1ID"/>
<ui:include src="/pages/includes/included2.xhtml"
id="included2ID"/>
... and so on.
There is some logic behind it which included page will be loaded, works fine.
I want to write some Javascript in the included pages which runs immediately as the page loads (for example in the included1.xthml
).
I tried adding this section right after the <ui:composition>
tag:
<h:head>
<h:outputScript>
.
.
some JS
.
.
</h:outputScript>
</h:head>
It works fine if I use it in a NOT included page, but doesn't work on included ones. Is there any way to add my JS to those pages?