InterPortlet Communication - Scenarios and Best Practices

I came across to many assignment in which I have implemented portlet communication in different ways based on various business needs. I also read various queries and responded solution on different forums where people are asking solution for interesting use cases for portlet communication.

I thought of writing this post just to summarize various portlet communication scenarios and what should the best practices applied for each of them.

There are various ways of achieving InterPortlet communication, depends on which portlet API and what portal server you are using.

Portlet communication when you have

1) JSR 168, Any Portal Server, Same Portlet application

Best Approach:- PortletSession with APPLICATION_SCOPE

2) JSR 168, IBM Portal Server, Same Portlet application

Best Approach:- PortletSession with APPLICATION_SCOPE

3) JSR 286, Any Portal Server, Different portlet application

Best approach depends on what type of value want to pass between source and target portlet. Here are various possibilities

 
a) String or array of String :- Public Render Parameter
 b) When data needs to be processed in receiver portlet:- Eventing concept
    
(Note: it is advisable to use public render parameters as they avoid the overhead for portlets event creation and wiring the portlets together.wiring portlets together is portal container specific and is an additional overhead.)

Have a look at my article on JSR 286 InterPortlet communication

4) JSR 286, IBM Portal Server, Different portlet application

   point 4 solution applies here, in addition to that if you want to pass Object
   Best approach:- DynaCache

Have a look at my article on
DynaCache scenarios and implementation


Some other Use cases
( IBM Portal server specific solution)

5) On click of portlet A, you want to trigger portlet B(same war or different war) on the same page or different page and passing string or array of string parameter
Solution:- IBM Advanced URL Generation Helper classes

Have a look at my post on InterPortlet communication in different WAR


6) On click of Portlet A, you want to show/hide some portlets
Solution:- IBM portal State API, please google it to find out more.


Other then these possibilities, if you have come across to any other use case, please feel free to share.
I would be more than happy to include all possible scenarios and best approach...

feel free to comment..

3 comments:

Anonymous said...

IBM sate api ???
What is this I don't see it in Google.

Neeraj Sidhaye said...

it is IBM Portal state API's.
typo error corrected...

Anonymous said...

can you please provide more details about showing and hiding a portlet in CSA theme. I have done it through the manipulating div but I want to know the standard way