OpenWGA 7.11 - TMLScript reference

TMLPortlet "portlet"
Property :


On object TMLPortlet "portlet"
Usage Returns the key of the portlet

The portlet key is an internal registration key that each portlet owns. The format of this key differs between portlet registry implementations.

While the portlet key is never used directly in WebTML/TMLScript it is needed for some clientside JavaScript functionalities (see JavaScript reference). This property can be used to supply those functionalities with the key. Note however that while this is a serverside TMLScript property the functionalities using the key are clientside JavaScript. To actually transport the key from server to client you need to render it in WebTML into code which is then executed as clientside JavaScript.

Return value The portlet key (String)

An example using the TMLScript property "portlet.portletkey" to pass the current portlet key to the clientside JavaScript method WGA.portlet.onload.register(). Note how the <tml:script> tag is used to retrieve the portlet key on the serverside, then render it into a string in JavaScript code (which is merely text output from a WebTML perspective). After the code is sent to the browser it will be executed by it.


WGA.portlet.onload.register('<tml:script expression="portlet.portletkey"/>', myJSFunction() { ... });