aspose file tools
The moose likes Portals and Portlets and the fly likes Retreiving atrributes from HttpSession in Portlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Reply Bookmark "Retreiving atrributes from HttpSession in Portlet" Watch "Retreiving atrributes from HttpSession in Portlet" New topic
Author

Retreiving atrributes from HttpSession in Portlet

RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi all,
I am trying to retrieve an attribute stored in the HttpSession in a portlet. But I always get a value as "null". I am using Jboss portal 2.6.1 with JDK 5. Please help. Here is the code snippet.
====================
servlet:

HttpServletRequest httpServletRequest=(HttpServletRequest)pageContext.getRequest();
HttpSession httpSession=httpServletRequest.getSession();
String testString="jjksdhfadhs";
//httpSession.getServletContext().setAttribute("test", testString);
httpSession.setAttribute("test", testString);

==============================
portlet in doView)

PortletSession portletSession=request.getPortletSession();
Object attributeFromPortletRequest=portletSession.getAttribute("test");
============================
On checking the portletSession.isNew(), I find it is a new object so what i have stored in the httpSession is not avialable here.

The Jboss reference guide =It is possible to have access to a portion of the portal session to store objects. The org.jboss.portal.api.session.PortalSession interface defines its API and is similar to the javax.servlet.http.HttpSession except that it does not offer methods to invalidate the session as the session is managed by the portal.


Regards,<br />Roshani
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retreiving atrributes from HttpSession in Portlet
 
Similar Threads
Displaying a Portal page dynamically based on PORTLET session attributes
getting PortletSession in JSF
Http Session and PortletSession?
PORTAL session NOT PortletSession
JSTL to get an object in portlet session?