title: JSTL fmt library throws 500 error, requires sessions enabled?
body: <p>I'm developing a simple servlet/JSP, data-driven web site on Google App Engine. I've started to use the JSTL fmt library on some of my data entry forms and get the following session-related error when using tags <code>&lt;fmt:dateFormat&gt; and &lt;fmt:numberFormat&gt;:</code></p>
  
  <p>[java] java.lang.RuntimeException: Session support is not enabled in appengine-web.xml.  To enable sessions, put true in that file.  Without it, getSession() is allowed, but manipulation of sessionattributes is not.</p>
  
  <p>The code in my JSP is, for example: </p>
  
  <pre><code>&lt;c:forEach var="item" items="${dayList}" &gt;
   &lt;option&gt;&lt;fmt:formatNumber value="${item}" pattern="00"/&gt;&lt;/option&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;jsp:useBean id="now" scope="page" class="java.util.Date" /&gt;
  Now: ${now}&lt;br/&gt;
  Year: &lt;fmt:formatDate value="${now}" pattern="yyyy" /&gt;
  </code></pre>
  
  <p>When I comment these lines out, the page renders, when turned back on, the error results.</p>
  
  <p>I don't have sessions enabled because I don't need them for this web application and read that it is better not to if you don't have to. I have confirmed that no attributes are session-scoped, the only occurrence of "session" in my NetBeans project is in web.xml: </p>
  
  <pre><code>&lt;session-config&gt;
      &lt;session-timeout&gt;
          30
      &lt;/session-timeout&gt;
  &lt;/session-config&gt;
  </code></pre>
  
  <p>Once I enable sessions on the appengine-web.xml everything works. </p>
  
  <p>My research has pointed to some locale-related context parameters that you may set in the web.xml, namely:</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;javax.servlet.jsp.jstl.fmt.fallbackLocale&lt;/param-name&gt;
      &lt;param-value&gt;en-US&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;javax.servlet.jsp.jstl.fmt.locale&lt;/param-name&gt;
      &lt;param-value&gt;en-US&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
  &lt;param-name&gt;javax.servlet.jsp.jstl.fmt.timeZone&lt;/param-name&gt;
      &lt;param-value&gt;EDT&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>I have redeployed with these parameters set (and with sessions off) and get the same error.</p>
  
  <p>The JSTL fmt library seems that it would be very conveniet to use for dates and numbers and such on web forms, though at the end of the day it may be that I just need to enable sessions and move on -- but am I missing something here with regard to locale settings that causes the session to be referenced by default?  Is this something particular to App Engine perhaps? </p>
  
  <p>Thanks</p>
  
  <p>P.S.
  This is the stack trace I get when sessions are disabled:</p>
  
  <pre><code> [java] Aug 17, 2010 2:41:26 AM com.google.apphosting.utils.jetty.JettyLogger warn
   [java] WARNING: /manage/events/new
   [java] java.lang.RuntimeException: Session support is not enabled in appengine-web.xml.  To enable sessions, put &lt;sessions-enabled&gt;true&lt;/sessions-enabled&gt; in that file.  Without it, getSession() is allowed, but manipulation of sessionattributes is not.
   [java]         at com.google.apphosting.utils.jetty.StubSessionManager$StubSession.throwException(StubSessionManager.java:67)
   [java]         at com.google.apphosting.utils.jetty.StubSessionManager$StubSession.setAttribute(StubSessionManager.java:63)
   [java]         at org.apache.jasper.runtime.PageContextImpl.doSetAttribute(PageContextImpl.java:340)
   [java]         at org.apache.jasper.runtime.PageContextImpl.access$300(PageContextImpl.java:64)
   [java]         at org.apache.jasper.runtime.PageContextImpl$4.run(PageContextImpl.java:314)
   [java]         at java.security.AccessController.doPrivileged(Native Method)
   [java]         at org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImpl.java:312)
   [java]         at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.setResponseLocale(SetLocaleSupport.java:209)
   [java]         at org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport.doEndTag(SetLocaleSupport.java:108)
   [java]         at org.apache.jsp.WEB_002dINF.update_005fevent_jsp._jspx_meth_fmt_setLocale_0(update_005fevent_jsp.java:362)
   [java]         at org.apache.jsp.WEB_002dINF.update_005fevent_jsp._jspService(update_005fevent_jsp.java:117)
   [java]         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
   [java]         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
   [java]         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
   [java]         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
   [java]         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
   [java]         at com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
   [java]         at com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:59)
   [java]         at java.security.AccessController.doPrivileged(Native Method)
   [java]         at com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:57)
   [java]         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
   [java]         at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
   [java]         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
   [java]         at com.cj.trim.trimFilter.doFilter(Unknown Source)
   [java]         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   [java]         at com.queerartfilm.web.JSTLConfigFilter.doFilter(JSTLConfigFilter.java:114)
   [java]         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   [java]         at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:51)
   [java]         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   [java]         at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
   [java]         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   [java]         at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
   [java]         at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
   [java]         at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
   [java]         at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
   [java]         at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
   [java]         at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
   [java]         at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
   [java]         at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
   [java]         at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
   [java]         at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:349)
   [java]         at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
   [java]         at org.mortbay.jetty.Server.handle(Server.java:326)
   [java]         at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
   [java]         at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
   [java]         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
   [java]         at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
   [java]         at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
   [java]         at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
   [java]         at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
  </code></pre>