Hi all,
There is a way to get JSR 168 portlets in the same portlet application to communicate with each other. As others have said (see
http://www.jroller.com/page/RickHigh?entry=jsr_168_inter_portlet_communication especially for details), if one portlet puts an object in the portlet session at "application scope," then another portlet in the same portlet application can access that variable.
For example, here's some code from a trivial example rigged up in RAD6:
From the View
JSP in the first portlet:
From the first portlet code:
From the View JSP in the second portlet (please forgive the use of scriptlets -- it's just to keep things simple):
This actually seems to work, as long as the two portlets are in the same portlet application. Even more, opening a second browser doesn't appear to interact with the first session at all, which is good.
My question is, if PortletSession.APPLICATION_SCOPE looks like session scope and acts like session scope, why not just call it session scope? I can't tell you how much time I wasted looking for a mechanism to do interportlet communication (wires, click-to-action, etc.) when there was one there all along.
Thanks,
Ken Kousen
[ Jess added
UBB [ code ] tags to preserve whitespace, and disabled smilies so the <portlet:DefineObjects/> doesn't have a smiley in the middle ]
[ November 22, 2005: Message edited by: Jessica Sant ]