On Wed, Feb 08, 2006 at 12:14:36AM +0100, Ed wrote:
> Yep, JSPs automatically create sessions (part of the JSP spec certainly).
> 
> To turn session off
> put <%@ page session="false" %> in your JSP.
> 
> Beware, that web frameworks such as struts may also create sessions for 
> other purposes (eg, storing the locale).
> you may also turn this off

        also beware that tomcat makes it _extremely_ hard to share content
between jsp pages that have session="false" and those that don't.  Even if
you try to wrap the access to the session scope in an "if" statement, tomcat
will refuse to compile the jsp file.  The closest I could get was a tag
file that contained this:
c:if test="<%= ((PageContext)jspContext).getSession() != null %>">
    <c:set var="optScope" value="<%= org.apache.commons.el.ImplicitObjects.creat
eSessionScopeMap((PageContext)jspContext) %>"/>
</c:if>

But even that fails because the getSession() call always returns null,
even if there is a session, if the including page has session="false".

I really wish there was a session="use_it_if_its_there" option.

eric

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to