taglibs-user@jakarta.apache.org
[Top] [All Lists]

Re: Retrieve a session attribute

Subject: Re: Retrieve a session attribute
From: Martin Cooper
Date: Thu, 14 Apr 2005 09:59:46 -0700
On 4/14/05, Vernon <vwu725@xxxxxxxxx> wrote:
> In Servlet, I have
> 
> request.getSession().getAttribute("cc");
> 
> The code returns the right result.
> 
> In JSP, when I have
> 
> <fmt:message key="cc.${sessionScope.cc}"/>
> 
> I get
> 
> java.lang.IllegalStateException: Cannot access session
> scope in page that does not participate in any session
> 
> I think the reason is that I have
> 
> <%@ page session="false"%> in the JSP file.

By specifying that the page does not participate in a session, you are
deliberately stating that no session be accessible from the page. If
you want to access the session, you need to change this to "true".

--
Martin Cooper


> I have tried to retrieve the session attribute in some
> other ways like the follogins I can think with a
> success. What is the right way to get the attribute
> with the JSTL?
> 
> <fmt:message key="cc.${requestScope.session.cc}"/>
> 
> <fmt:message key="cc.${pageContext.session.cc}"/>
> 
> The both yeild ??cc.??
> 
> Thanks.
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@xxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: taglibs-user-help@xxxxxxxxxxxxxxxxxx
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: taglibs-user-help@xxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>