Tuesday, December 23, 2003

Sharing Session Among Portlets

IBM WebSphere Portal Server way
Put these lines for each portlet in web.xml file.

<init-param>
<param-name>com.ibm.wps.portlet.session</param-name>
<param-value>shared</param-value>
</init-param>

JSR 168 way
In the JSR 168 spec the <init-param> does not exist So to share attribut among portlets two scopes from the PortletSession object can be used :

PortletSession.PORTLET_SCOPE
PortletSession.APPLICATION_SCOPE
and use portletSession.setAttibute(attName, attValue, scope)
with thanks to Benjamin Mestrallet of 'eXo' fame

No comments:

Post a Comment