• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

portlet communication

 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can portlet communicate with another portlet ?
 
author
Posts: 469
20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please explain more on Public render parameters ?
 
Ashish Sarin
author
Posts: 469
20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic