Pages

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:this.attributes>
<xp:parameter name="clientSide" value="true"></xp:parameter>
<xp:parameter name="src">
<xp:this.value>
<![CDATA[#{javascript:return applicationScope.get("senchaSourceBase")+"sencha-touch-debug.js"}]]>
</xp:this.value>
</xp:parameter>
</xp:this.attributes>
</xp:headTag>

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 .

    ReplyDelete