Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to access a session attribute

843838Jan 30 2006 — edited Jan 30 2006
I'm in the process of converting a regular web application to a portlet. I expected some issues allong the way, but access variables was not one of them. I am posting her because I can see the object in the sessionScope. It just doesn't seem to have a name I can reference.

public Object getKey(PortletRequest request)
{
request.getPortletSession().setAttribute("KEY", object);
}

I have a debug.jsp that list session varibles done like so:

<tr>
<th colspan="2" style="background:aqua"><b>session</b></th>
</tr>
<c:forEach items="${sessionScope}" var="itm">
<tr>
<td><c:out value="${itm.key}"/></td>
<td><c:out value="${itm.value}"/></td>
</tr>
</c:forEach>

Which prints out this: (I've removed some output....)
session
com.liferay.util.servlet.SessionParameters gnu.trove.THashMap@b867500b
COMPANY_ID liferay.com
PORTLET_RENDER_PARAMETERS gnu.trove.THashMap@1a0725a3
LAST_PATH com.liferay.util.ObjectValuePair@fd8b9
javax.portlet.p.portletname-web-1.0.0_WAR_dispatch_portlet?KEY com.liferay.portletname.admin.util.Object@1967db7
IMAGE_PATH /image
USER_ID liferay.com.1
USER_PASSWORD ****
CTX_PATH /c
SHARED_SESSION_ID YEM3OO9KF87J
CACHE_PORTLET_RESPONSES gnu.trove.THashMap@0

So far so good, I can see the object I want in the session, but how do I reference it? The object I want is this one:
javax.portlet.p.portletname-web-1.0.0_WAR_dispatch_portlet?KEY com.liferay.portletname.admin.util.Object@1967db7


Any help would be much appriciated.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 27 2006
Added on Jan 30 2006
1 comment
282 views