You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Gudiyella, Pavan" <PG...@Tribune.com> on 2007/02/07 20:44:22 UTC
getting session attribute or request attribute in header.vm
Hi,
I am having trouble getting the session attribute in velocity files in
jetspeed2.
I am setting an attribute in session in portlet. To be specific I am
putting in doView() method
request.getPortletSession().setAttribute("session_attr", "sessionValue",
PortletSession.APPLICATION_SCOPE);
I am trying to access it in header.vm as follows. Listing all the options
that I tried.
1. $request.session.getAttribute("session_attr")
2. $request.getSession().getAttribute("session_attr")
3. #set($reqCont =
$renderRequest.getAttribute("org.apache.jetspeed.request.RequestContext"))
reqCont session id is $reqCont.getRequest().getSession().getId()
reqCont attribute is
$reqCont.getRequest().getSession().getAttribute("session_attr")
When I print the session Id in the portlet code and in the velocity code, it
is SAME
However, I am unable to retrieve session attributes or request attributes
that were put in portlet in header.vm.
Could someone respond with a solution?
Thanks
Pavan Kumar Gudiyella
Tribune Media Services
pgudiyella@tribune.com
(312)-222-3192
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
Re: getting session attribute or request attribute in header.vm
Posted by David Sean Taylor <da...@bluesunrise.com>.
On Feb 7, 2007, at 11:44 AM, Gudiyella, Pavan wrote:
> Hi,
>
> I am having trouble getting the session attribute in velocity files in
> jetspeed2.
>
> I am setting an attribute in session in portlet. To be specific I am
> putting in doView() method
>
> request.getPortletSession().setAttribute("session_attr",
> "sessionValue",
> PortletSession.APPLICATION_SCOPE);
>
>
> I am trying to access it in header.vm as follows. Listing all the
> options
> that I tried.
>
> 1. $request.session.getAttribute("session_attr")
>
> 2. $request.getSession().getAttribute("session_attr")
>
> 3. #set($reqCont =
> $renderRequest.getAttribute
> ("org.apache.jetspeed.request.RequestContext"))
> reqCont session id is $reqCont.getRequest().getSession().getId()
> reqCont attribute is
> $reqCont.getRequest().getSession().getAttribute("session_attr")
>
> When I print the session Id in the portlet code and in the velocity
> code, it
> is SAME
> However, I am unable to retrieve session attributes or request
> attributes
> that were put in portlet in header.vm.
>
> Could someone respond with a solution?
>
There was just a thread on the Jetspeed User yesterday that could
help you.
See the thread titled "How can I hide portlet programmatically"
initiated by Vitaly.
He has come up with a solution that may help you
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org