10.3.3 namespace

Both APIs use namespacing to uniquely identify portlets on a page. The portletAPI:encodeNameSpace tag and the portlet:namespace tag have the same function, but they are implemented quite differently. While the IBM API tag take a value attribute used to concant to the end of the namespace, the JSR tag will just return the namespace without accepting an attribute.

Example 10-13 Namespace using tags

IBM API namespace
<portletAPI:encodeNamespace value="name" />

JSR 168 namespace
<portlet:namespace/>

You can also use the method the RenderResponse class to get the namespace.

Example 10-14 Namespace using PortletResponse objects.

IBM API namespace method
response.encodeNamespace("name");

JSR 168 API
response.getNamespace();


Redbooks
ibm.com/redbooks