2 Easy Steps to Implement Inter-Portlet Communication with WSRP 2.0

One of the most mysterious topics of the portal world is inter-portlet communication. Some of you expressed interest in portlet technologies in an earlier poll, so here we go…

Before the 2.0 versions of the portlet standards were ratified (WSRP 2.0, JSR 286), inter-portlet communication could only be achieved with some sort of a hack. Typical implementations included vendor-specific extensions on top of the portlet standards (breaking inter-operability), or portlets using a shared store to exchange information, such as the session context or a database. All of these workarounds required a hacker attitude.

The easiest way to try out the concept is by using two of the sample portlets from the WSRP Sample Portlet Producer: the Parameter Form and Parameter Display portlets. Here are the introductory steps you need to take, that are not related to inter-portlet communication, and you may well be familiar with:

  1. Start up the preconfigured OC4J. First, point your browser to http://localhost:6688. Then click on the Sample Portlets link (http://localhost:6688/portletapp/info).
  2. Copy the WSRP 2.0 WSDL end point URL (you find it on the bottom of the page) to your clipboard: http://localhost:6688/portletapp/portlets/wsrp2?WSDL.
  3. Create an application in JDeveloper, based on the WebCenter Application Template.
  4. Register the WSRP Sample Producer with your application.


  5. Create a new jspx page, and drop the Parameter Form and Parameter Display portlets onto the page.

It takes only two steps to set up inter-portlet communication – and this is the actual meat of this post.

  1. Wire the two portlets, so the parameters entered in the parameter form portlet are passed to the parameter display portlet.
    1. Switch to the page definition of the page (invoke the context menu in the middle of the page, and select Go to Page Definition. If the page definition doesn’t exist yet, let JDeveloper create it for you.
    2. Locate the two portlets in the Structure Pane, and expand the Parameters section to see the three WSRP 2.0 navigational parameters that these portlets provide. Notice that the portlet parameters are mapped to page variables. All you need to do is make sure that the portlet parameters of the Parameter Form Portlet are mapped to the same page variables as the parameter of the Parameter Display Portlet.
    3. Confirm your changes by taking a look a the source of the page definition.
  2. Configure partial page refresh, so the parameter form display portlet refreshes when a new parameter is submitted in the parameter form portlet.
    1. On your jspx page select the Parameter Display portlet and locate Partial Triggers attribute. Point to the id of the Parameter Form portlet, for example portlet1.

That’s it!

Now run the application and enter some values into the Parameter Form portlet.

Click the OK button. The Parameter Display portlet should refresh with partial page refresh (PPR).

“And the crowd goes wild…” [B.H.]

Advertisements

3 Responses

  1. Peter,

    WCI has pretty rich functionality around inter-portlet comm. Implemented with JavaScript. Engineers had also documented a set of models describing different behaviors that you could achieve: master/slave, etc. Brian Harrison can certainly give you more detail if you are not already familiar with this.

    Gary

  2. hi,

    i also want to implement the same thing, but on a portletized application. Basically, I have a JSF page that retrieves data using Data Control. I used Create Portlet entry to convert it to Portlet. Then I manually edit the oracle-portlet.xml to add a navigation parameter.

    What I want to do is, set the input of the Data Control to the value of the navigation parameter. Is this possible? Do I have to edit anything else? It seems that the navigation parameter is not showing up on the Edit Property dialog.

    Thanks in advance!

  3. Peter,

    thank you for the post and excellent materials in Webcenter 11g Handbook.
    But example in this post works absolutely without binding among portlet parameters and page variables:) In case of Parameter Form and Parameter Display portlets it’s necessary only to drop portlets onto the page and run it. Parameters will be submitted from Parameter Form to Parameter Display Portlet. As example of inter-portlet communication through page variables it’s not work:).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: