By the way many thanks for the exceptional work on the standard tag library. It's really a joy to work with. As an experiment, I'm porting some scriptlet-laden pages to JSTL. It's amazing how much it cleans things up.
The one thing I really would have liked was the ability to test the size of a collection before I iterate it. (in my case I needed to know when there is exactly 1 item) I know there was a discussion on this a little while ago and saw your workaround to pre-iterate it, but it's not a practical solution for large collections. So while I had your ear, I just wanted get my vote in to add some way to do it. Although I'm sure it's too late. --LH -----Original Message----- From: Shawn Bayern [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 4:20 PM To: Tag Libraries Users List Subject: Re: [standard] query tag exception when no session (By the way -- many thanks for reporting the issue! Jeez, I've been so pressed for time recently that my manners are slipping. :) ) Shawn On Wed, 24 Apr 2002, Halvorson, Loren wrote: > The <sql:query> tag throws an exception in a page that has no session > unless I provide the maxRows="-1" parameter. I just tested this with > the nightly build from April 24 on Tomcat 4.0.2. Is this normal > behavior...is a Session required? It seems like it should just skip > checking the session if one has not been created yet, and default to > -1 for maxRows. > > Here is the essence of the page: > ------------------------------ > <%@ page language="java" contentType="text/html;charset=UTF-8" > session="false" %> > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ > taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %> > > <sql:transaction dataSource="${myDataSource}"> > <sql:query var="rset"> <-- when I add maxRows="-1" here it works > ...my query... > </sql:query> > </sql:transaction> > > <c:forEach var="row" items="${rset.rows}"> > : > </c:forEach> > ------------------------------ > > And here is the stack trace from Tomcat's log: > > 2002-04-24 16:05:57 StandardWrapperValve[jsp]: Servlet.service() for > servlet jsp threw exception > java.lang.IllegalArgumentException: can't access SESSION_SCOPE without > an HttpSession > at > org.apache.jasper.runtime.PageContextImpl.getAttribute(PageContextImpl > .java: > 215) > at javax.servlet.jsp.jstl.core.Config.get(Config.java:117) > at javax.servlet.jsp.jstl.core.Config.find(Config.java:351) > at > org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryT > agSupport.java:171) > at > org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.java:125 > ) > at org.apache.jsp.browsepl$jsp._jspService(browsepl$jsp.java:123) > at > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) > : > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
