Monday, January 31, 2011

Xpages - How to dynamically add client side script library? (xp:headTag)

The following is a way using which u can include client side javascript libraries into xpages in a dynamic fashion. Yes it lets you compute javascript library's URL in the XPage.

Note the usage of the scoped variables along with custom text in constructing the url of the script library

<xp:headTag tagName="script" rendered="true" loaded="true">
<xp:parameter name="clientSide" value="true"></xp:parameter>
<xp:parameter name="src">
<![CDATA[#{javascript:return applicationScope.get("senchaSourceBase")+"sencha-touch-debug.js"}]]>

To know about including style sheets in similar fashion click here

Hope this helps :)

1 comment:

  1. The complex type tag (xp:headTag) must be within a property tag, like .