This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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 Dorothy [ January 27, 2008: Message edited by: Dorothy Taylor ]
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:
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
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).