tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mfncoo...@gmail.com>
Subject Re: Retrieve a session attribute
Date Thu, 14 Apr 2005 17:12:41 GMT
On 4/14/05, Vernon <vwu725@yahoo.com> wrote:
> 
> --- Don Albertson <Don.Albertson@verizon.net> wrote:
> > Vernon 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.
> >
> > Is there a reason why you are trying to use session
> > scope when there is no session?
> >
> 
> My understanding of how the servlet works in term of a
> session creation is that the container will create a
> session every time when a new user access the server.
> It seems to be correct from my short test with the
> session ID. A session exists before accessing the JSP
> file.

In a servlet, a session will be created on a call to getSession() or
getSession(true) if one did not already exist. In a JSP, if a session
does not exist and the page has session="true", one will be created.

--
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@jakarta.apache.org
> > > For additional commands, e-mail:
> > taglibs-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> > --
> > In the elder days of art
> > Builders wrought with greatest care
> > Each minute and unseen part
> > For the Gods are everywhere.
> > Longfellow.
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > taglibs-user-help@jakarta.apache.org
> >
> >
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message