1つの(メイン)Faceletsページに以下のコードがあります。
<h:panelGroup rendered="true">
<ui:insert>
<ui:include src="/includeSecondPage.xhtml" />
</ui:insert>
</h:panelGroup>
以下は、includeSecondPage.xhtmlページのコンテンツです。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core">
<head>
<script type="text/javascript">
/* <![CDATA[ */
function myScript ()
{
alert("Inside myScript");
}
myScript();
/* ]]> */
</script>
</head>
<f:view>
<body>
<h:form id="secondForm">
<ui:composition>
<h:outputText value="This panel is called using Component Control Component"></h:outputText>
</ui:composition>
</h:form>
</body>
</f:view>
</html>
includeSecondPage.xhtmlでJavaスクリプトが呼び出されません。この2番目のページを含む最初の(メイン)ページにアラートボックスがポップアップしません。また、JavaスクリプトコンソールにはJavaスクリプトエラーはありません。