wood burning stoves*
The moose likes Portals and Portlets and the fly likes portlet communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "portlet communication" Watch "portlet communication" New topic
Author

portlet communication

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

How can portlet communicate with another portlet ?


Groovy
Ashish Sarin
author
Ranch Hand

Joined: Nov 20, 2000
Posts: 432
    
    5
Hi Pradeep,

Inter-portlet communication is achieved using one of the following approaches:
- Public render parameters - render parameters available to all the portlets on a portal page
- Portlet events - event-based inter-portlet communication
- Session - portlets can communication via APPLICATION_SCOPEd data

In some scenarios, AJAX is also used to achieve inter-portlet communication. For instance, Portlet A makes an AJAX call on the server and gets some data. The callback method knows the id attribute of an HTML <div> element of another Portlet B, which it uses to modify the content inside the <div> tag of Portlet B. This is not a standard approach.

regards
ashish


Author of
Getting started with Spring Framework
Portlets in Action
Spring Roo 1.1 Cookbook
Portlets blogSpring Roo blog
Jason Mayer
Ranch Hand

Joined: Oct 16, 2007
Posts: 31
Ashish Sarin wrote:Hi Pradeep,

Inter-portlet communication is achieved using one of the following approaches:
- Public render parameters - render parameters available to all the portlets on a portal page
- Portlet events - event-based inter-portlet communication
- Session - portlets can communication via APPLICATION_SCOPEd data

In some scenarios, AJAX is also used to achieve inter-portlet communication. For instance, Portlet A makes an AJAX call on the server and gets some data. The callback method knows the id attribute of an HTML <div> element of another Portlet B, which it uses to modify the content inside the <div> tag of Portlet B. This is not a standard approach.

regards
ashish


If you're using liferay 5, see this page for javascript updating of other portlets: http://www.liferay.com/community/wiki/-/wiki/Main/Client-side+Inter-Portlet+Communication. Liferay 6 also has a slightly different way, but the goal is still the same.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Can you please explain more on Public render parameters ?
Ashish Sarin
author
Ranch Hand

Joined: Nov 20, 2000
Posts: 432
    
    5
Hi Pradeep,

In general render parameters are private in nature and not available outside the portlet. Let's say you set a render parameter X in action method of portlet A. When portlet A is rendered (after the execution of action method), the render method makes use of the render parameter X in someway that it affects the generated content. For instance, X could represent success/failure of the action method. Now, you may want this render parameter X to be available to other portlets on the same portal page so that they can use it while generating their own content. To do so, you configure the parameter X as a 'public render parameter' in portlet.xml file, making it available to other portlets also.

As render parameters can only be of type String, their use is limited in inter-portlet communication. Events can carry payload (which could be a complex object), in some scenarios you'll find it more appropriate to use event-based IPC.

regards
ashish
Venkat Sarvesh
Greenhorn

Joined: Apr 28, 2011
Posts: 1
Hi Ashish,

It seems that you have good experience in Portlets. I need one help. I want to open or show portletB when I click some link in portletA. Dont know how to link the two portlets. I am able to create two porlets but not able to do this action. I was using JetSpeed. Please help me on this.

Thanks & Regards
Sarvesh
Gilbert Tan
Greenhorn

Joined: May 29, 2009
Posts: 5
There are many ways to do this. And some approaches are portlet standard/ container specific.

1. If you are using IBM Portal Server, you can use 'Portlet Wiring'. This is compatible even with JSR168 standard.
http://publib.boulder.ibm.com/infocenter/wpdoc/v510/index.jsp?topic=/com.ibm.wp.ent.doc/wps/wpsc2aconfig.html

2. Another simple idea is to use the friendly URL of each page. Friendly URLs for pages are configured when you are configuring the portal pages. You can redirect the the user to the other portal page, and then that page loads, the doView (JSR168) in the target portlet is called. Before you redirect you can set the parameter values to the portlet session (both source and target portlets should have to be bundled as a single application).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: portlet communication
 
Similar Threads
How to convert Jboss EAR to Portlet?
PORTLETS WITH JBOSS
init and ClassNotFound Exception
portlet displaying commons vaidator errors
Liferay Portlet: Form Actions