Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

portlet session?

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is portlet session is same as servlet session?

Can two portlet share the same portlet session just like two servlet can share servlet session?

Thanks.
 
Mouli Velu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
PortletSession extends the HttpServletSession.
The PortletSession object is different for each portlet.
PortletSession of one portlet cannot be accessed by another portlet.
 
Stefan Zoerner
Author
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi rathi!

Are you talking about JSR 168 portlets or some vendor specific programming model (IBM, for instance)?

In JSR 168, the PortletSession is technically the same as the HttpSession from the underlying Web application. But the important difference is, that the PortletSession interface enables you to use two different scopes: application and portlet. If you use application, all portlets of the same portlet application share the same user session. Therefore you can exchange attributes between portlets via a session, if the portlets are within the same portletapp. See JSR 168 spec or javadoc for details.

I hope that helped (drop a mail, if you use another API than JSR 168),
Stefan
[ December 16, 2005: Message edited by: Stefan Zoerner ]
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using IBM portlet. In that, two portlet can't share the same session. But then I didn't get the use of session. One portlet is adding something into session and the same portlet is getting that then what is the need of these all, it already have access to that data....

Hope my question is clear.

Please Comments.
Thanks.
 
Stefan Zoerner
Author
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rathi,

I do not know the IBM specific API, even WebSphere Portal allows you to use the standard compliant programming model JSR 168 (with its restrictions) starting with 5.0, and this is what we use.

But even within a single portlet a session at least enables you to keep state between requests, for instance navigational state. There are other options to accomplish this, but attributes within a session are convenient (arbitrary objects allowed, for instance) -- but use them wisely ;-)

Stefan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic