• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

How to pass session data between 2 Portlets???

Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a basic doubt in portals . Can we pass session (HttpSession or PortletSession ) data from one portlet to another portlet???

If yes please tell me how to do that??

Thanks in advance,
Rajendra Prasad.
author and cow tipper
Posts: 5006
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer is yes and no.

Not only can portlets not share session data with other portlets, they can't even share session data between the exact same type of portlet if that portlet appears more than once on the same page (portlet instance, I guees).

However, JSR168 introduced something called APPLICATION_SCOPE for portlet session. With application scope, you can share session data between portlets that are part of the same portlet application (packaged in the same war)

This puts something into the session in one portlet, using APPLICATION_SCOPE

This pulls it out:

Note that APPLICATION_SCOPE is not the default.

I have a tutorial that demonstrates how APPLICATION_SCOPE works, and also have a completed JSR168 war file you can download and mess around with the code on your own.

Free Tutorial on the various PortletSession Scopes


-Cameron McKenzie
bacon. tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic