The recommended way to add scripting to your JSPX page is via the
metaContainer <facet> tag. You add the
metaContainer <facet> within the
<af:document> tag. You can group your scripts within the
metaContainer <facet> using an
<af:group> tag. The actual script should be added within an
<afh:script> or a
<trh:script> tag. Adding Javascript to your JSPX page by directly placing a
<script> tag is not recommended because it could have undesired side effects related to the proper resizing of the components in the page.
Example:
<f:facet name="metaContainer">
<af:group>
<afh:script source="/js/YourJsLibrary.js"/>
<afh:script>
function someFunction()
{
…
}
</afh:script>
</af:group>
</f:facet>
Context:
JSPX Page