Bug 36637 - [PATCH] <%@page session="false"%> causes exception in <x:set>
Summary: [PATCH] <%@page session="false"%> causes exception in <x:set>
Status: RESOLVED DUPLICATE of bug 35216
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Standard Taglib (show other bugs)
Version: unspecified
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-13 14:52 UTC by Martin Algesten
Modified: 2005-09-13 08:11 UTC (History)
0 users



Attachments
Fix to XPathUtil.java that checks if a session is available before getting the attributes. (1.51 KB, patch)
2005-09-13 14:53 UTC, Martin Algesten
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Algesten 2005-09-13 14:52:44 UTC
When using jakarta-taglibs-standard-1.1.2 in JSP pages where I first declare:

<%@page session="false"%>

I get an exception when using

<x:set>

The exception is:

java.lang.IllegalStateException: Cannot access session scope in page that does
not participate in any session
        at
org.apache.jasper.runtime.PageContextImpl.doGetAttributeNamesInScope(PageContextImpl.java:501)
        at
org.apache.jasper.runtime.PageContextImpl.getAttributeNamesInScope(PageContextImpl.java:487)
        at
org.apache.taglibs.standard.tag.common.xml.XPathUtil.getVariableQNames(XPathUtil.java:100)
        at
org.apache.taglibs.standard.tag.common.xml.XPathUtil.fillVarStack(XPathUtil.java:772)
...
 
Looks like XPathUtil always assumes a session is available.

My setup is briefly:

jakarta-tomcat-5

web.xml starts:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">
..


and an example page that causes trouble:

<%@ page session="false" %>

<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/core" %>

<x:parse var="xml">
  <test>blah</test>
</x:parse>

<x:set var="test" select="$xml"/>
Comment 1 Martin Algesten 2005-09-13 14:53:53 UTC
Created attachment 16386 [details]
Fix to XPathUtil.java that checks if a session is available before getting the attributes.
Comment 2 Rahul Akolkar 2005-09-13 16:11:48 UTC

*** This bug has been marked as a duplicate of 35216 ***