Inter Portlet Communication, using public render parameters in Liferay

Let's go with an example of Inter Portlet Communication (IPC) of portlets in Liferay Portal 5.x. The tags navigation and the category navigation portlet in Liferay use the public render param to communicate with other portlets. In the portlet deployment descriptor we can see a portlet section:

<portlet>
 <portlet-name>141</portlet-name>
 <display-name>Tags Navigation</display-name>
 .....
 <supported-public-render-parameter>folksonomy</supported-public-render-parameter>
 <supported-public-render-parameter>tag</supported-public-render-parameter>
</portlet>


that defines the public render parameters supported by the 141 portlet id.

<public-render-parameter>
 <identifier>folksonomy</identifier>
 <qname xmlns:x="
http://www.liferay.com/public-render-parameters ">x:folksonomy</qname>
</public-render-parameter>
<public-render-parameter>
 <identifier>tag</identifier>
 <qname xmlns:x="
http://www.liferay.com/public-render-parameters ">x:tag</qname>
</public-render-parameter>


and the definition of their corresponding parameters.

If we build a JSP portlet sample with the plugin SDK, adding to the portlet deployment descriptor the above commented definition and supported tags, we can use this render public parameters for inter portlet comunication.

To demostrate this functionality, we create a new page in the guest community and we add 3 portlets:

  • Tags Navigation Portlet
  • Categories Navigation Portlet
  • IPC render public (you can download the code from this link)

Then, just create some categories and tags, and then go to the created page and click into the link for the categories or tags. The render public parameters will appear into the IPC render public portlet.

 

00

More Blog Entries

0 Comments