liferay Inter portlet communication Using Public render parameter


Example

This approach was introduced in JSR 286.

In JSR 168,render parameters set in processAction of a portlet were available only in that portlet.With the Public Render Parameters feature, the render parameters set in the processAction of one portlet will be available in render of other portlets also.In order to configure this,for all the portlets supporting this:

Add <supported-public-render-parameter> tag ,just before the portlet tag ends in portlet.xml

<security-role-ref>
    <role-name>user</role-name>
</security-role-ref>
<supported-public-render-parameter>{param-name}</supported-public-render-parameter>
</portlet>

Add <public-render-parameter> tag just before the <portlet-app> tag ends

  <public-render-parameter>
    <identifier>{param-name}</identifier>
    <qname xmlns:x="localhost">x:{param-name}</qname>
  </public-render-parameter>
</portlet-app>

In the processAction method,the param value needs to be set in the response

res.setRenderParameter({param-name},{param-value});

Post we are done with configuring this for all the required portlet,after executing the action phase of the concerned portlet,the param should be available in render phase for all supporting portlets on the page,irrespective of being part of same or different application(war).