Monday, April 20, 2009

Inter Portlet Communication in JSR 286

JSR 168 (Potlet 1.0) specification doesn't clearly suggest any mechanism for the inter-portlet communication i.e. communication between two portlets. This was regarded as one of the major short-comings for JSR 168. Though most of the vendors had their own extensions to JSR 168 for managing inter-portlet communication, use of any of those methods defeat the very purpose of JSR 168. In absence of any well defined sophisticated mechanism, JSR 168 developer had to rely upon either PortalContext or Application Scope of Session for sharing information between the protlets.

JSR 286 has come up with a well defined model to achieve inter-portlet communication. There are two primary ways by which inter-portlet communication can achieved as follows -

1. Public Render Parameters
2. Portlet Events

There are pros and cons of each method. Though the biggest advantage with Portlet Events method is that an object can be passed from one portlet to another as opposed to merely "String" in case of "Public Render Parameters" method.

Both the approaches has been talked about in this blog post with the implementation approach. Please have a look - http://blog.xebia.com/2009/04/19/inter-portlet-coordination-with-jsr-286/

7 comments:

  1. Awesome explaination Punit. It explains all the relevant detail a Portal Developer like me faces when implemnting the JSR-168 interportlet communication.

    ReplyDelete
  2. Anonymous3:48 PM

    Dear Mr.Punit,
    This question is not about portals but have you tinkered with developing any software for predicting the results of horse racing? How can one use astrology for predicting such outcomes?
    lacosloca564@hotmail.com

    ReplyDelete
  3. Hi Punit,

    Have you ever tried of making asynchronous requests using Yahoo Util Connect (YUC) in JSR 168 Portal?

    ReplyDelete
  4. Hi Punit,
    Is it possible to communicate between 2 JSR168 based portlets running on different portal servers?

    ReplyDelete
  5. Hi Punit,
    I have 2 portlets which are to be communicated which will be acting as source and targets i.e., I will be coming from the source to the target and target to source. When navigating from the portlets I am facing an issue. Second time I am unable to navigate from source to Target.

    ReplyDelete
  6. // When navigating from the portlets I am facing an issue. //
    By navigation, do you mean that there is change in page? Or both the portlets are on the same page?

    ReplyDelete
  7. Anonymous6:24 PM

    Hi Punit, I have 2 portlets on my portal (JSR286) on IBM websphere. I want to pass string from portlet 1 to portlet 2, similarly from portlet2 to portlet1. Can you give me sample code of the same.

    ReplyDelete