File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Portals and Portlets and the fly likes portlet session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "portlet session" Watch "portlet session" New topic

portlet session

Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104

Are there any things that we should keep in mind while developing JSR -168 portlets as regards the session? Is session optimization a concern? What all things should be kept in mind while placing an object in session? How big can the session be?

Appreciate your help
[ January 27, 2008: Message edited by: Dorothy Taylor ]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

The same rules that apply to HttpSessions apply to the PortletSession. In fact, under the cover, they are usually the same thing. Minimize session use when possible, but don't do it at the expense of the ease of development and maintainability.

Here are some JSR-168 Portlet Development Best Practices that I put together, which includes some discussion of the Portlet Session:

Portal & Portlet Development Best Practices

Kind regards,

-Cameron McKenzie
Sathya Sekar

Joined: Dec 17, 2003
Posts: 15
I am just starting to get some hold on the portlet session and was wondering (
pl pardon if this is totally incoherent and I am just jumping the learning gun..)

Lets say we have two different portlet apps (2 wars) - is it possible :
a) to have a single window which can display portlets across both these apps
b) if yes, how does the session behave ? I mean, since these are two different portlet apps, the portlet scopes would be different for the two which could mean that they dont share the same session id. Is this right ?

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Many times the complexities of the portal can be alleviated by relying on your knowledge of plain old Servlets and JSPs.

With Servlet and JSP apps, the session can't cross a war file. The exact same thing can be said for a portlet war file - you can't share sessions across a war.

Why not put both of these portlets in the same war? If there's a compelling reason for them to communicate, then perhaps they should be packaged as part of the same app. Just add another entry to the portlet.xml file. So many portlet books (not mine of course) only ever show one portlet per war file. I can't think of too many J2EE applications with only one command object, so why would most portlet applications only have one portlet? (sorta equiavlent to a JSF or Struts command object).

Think about it.

-Cameron McKenzie
[ January 28, 2008: Message edited by: Cameron McKenzie ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Please check your private messages.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Fred Grott
Ranch Hand

Joined: Oct 05, 2002
Posts: 346

I face the same problem, google IPC library

You will have to ejb side it with a db table to store the sessions and use the library to send sessions via message que

MobileBytes blog - Sharing Technology - My Programming Knols
I agree. Here's the link:
subject: portlet session
It's not a secret anymore!