Relocatable Resources (original) (raw)

You can place a resource tag in one part of a page and specify that it be rendered in another part of the page. To do this, you use thetarget attribute of a tag that specifies a resource. Acceptable values for this attribute are as follows.

For example, the following h:outputScript tag is placed within anh:form element, but it renders the JavaScript in the head element:

<h:form>
    <h:outputScript name="myscript.js" library="mylibrary" target="head"/>
</h:form>

The h:outputStylesheet tag also supports resource relocation, in a similar way.

Relocatable resources are essential for composite components that use stylesheets and can also be useful for composite components that use JavaScript. See The compositecomponentexample Example Application for an example.