Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pass session data between 2 Portlets???

 
rajen prasad
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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

Enjoy!

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic