[jboss-dev-forums] [Design of JBoss Portal] - Accessing session attributes in a portlet

segal96 do-not-reply at jboss.com
Mon Jan 5 14:27:47 EST 2009


I have a servlet filter intercepting all http reqs to my portal and setting session attributes (strings) that I'd like to access in portlets.  Is this possible?  If so, can someone tell me what I'm doing wrong?

#########
In the servlet:
#########
HttpSession session = httpRequest.getSession(true);
session.setAttribute("attr1","somestring");

#########
In the portlet:
#########
String attribute = (String)readRequest.getPortletSession().getAttribute("attr1", PortletSession.APPLICATION_SCOPE);

// Always returns null for some reason???
System.out.println(attribute);

Cheers,
-Steve

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199612#4199612

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199612



More information about the jboss-dev-forums mailing list