Saturday, 17 March 2012

Working with portlet container in websphere application server 7.0-Part8

You can use either the events mechanism or the public render parameters mechanism to coordinate portlets within a portal.

JSR 286 defines these two mechanisms as follows:
  • Events: Loose-coupling of portlets during action phase.
  • Public render parameters: Sharing of view state between portlets.
The WebSphere Application Server portlet container supports both concepts with one exception. The wiring of events on a portal level is not supported. 

To make use of the public render parameters on a portal page defined with the aggregation tag library, you must explicitly declare the portal scope:

<%@ taglib uri="http://ibm.com/portlet/aggregation" prefix="portlet" %>
<%@ page isELIgnored ="false"%>
<!-- define portal scope for public render parameters -->
<portlet:scope>
        <portlet:portlet context="/myjsrsender" portletname="MyJSR286Sender" windowId="stephan"/>
        <portlet:portlet context="/myjsrreceiver" portletname="MyJSR286Receiver" windowId="birga"/>
</portlet:scope>

<portlet:init portletURLPrefix="/myportletcoord/portal/">

<!-- insert your portlets here, wrapped with your html markup -->
...
   <portlet:insert url="myjsrsender/MyJSR286Sender" windowId="stephan" titleVar="portlettitle_1"/>
...
   <portlet:insert url="myjsrreceiver/MyJSR286Receiver" windowId="birga" titleVar="portlettitle_2"/>
...
</portlet:init>

The public render parameters are only visible to the portlet windows mentioned within this defined scope. This condition assumes, as a prerequisite, that the corresponding portlets have also declared support for a given public render parameter in their portlet.xml file, according to the JSR 286 specification:
MyJSR286Sender.war(portlet.xml)

   <portlet>
      <portlet-name>MyJSR286Sender</portlet-name>
       ...
       <supported-public-render-parameter>foo</supported-public-render-parameter>
   </portlet>

  
<public-render-parameter>
        <identifier>myname</identifier>
        <qname xmlns:x="http://MyJSR286/">x:name</qname>
    </public-render-parameter>

MyJSR286Receiver.war(Portlet.xml)

   <portlet>
      <portlet-name>MyJSR286Receiver</portlet-name>
       ...
       <supported-public-render-parameter>myname</supported-public-render-parameter>
   </portlet>
   <public-render-parameter>
        <identifier>myname</identifier>
        <qname xmlns:x="http://MyJSR286/">x:name</qname>
    </public-render-parameter>


No comments:

Post a Comment