On Fri, May 7, 2010 at 10:39 AM, Christopher Schultz <ch...@christopherschultz.net> wrote: > All, > > I'm a complete newbie to JSTL and I'm having trouble getting a simple page > to render. The page below gives me the error: > > org.apache.jasper.JasperException: /tasks.jsp(18,6) According to TLD or > attribute directive in tag file, attribute items does not accept any > expressions > org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) > org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) > [...] > > It seems to me that "items" had better be an expression. > > I have a fresh install of Tomcat 6.0.26 running on Sun's 1.6.0-_20-b02 JVM > on 32-bit Linux. I downloaded the JSTL "api" and "impl" packages from > https://jstl.dev.java.net/download.html and put the JAR files directly into > WEB-INF/lib. > > <%@ page > pageEncoding="UTF-8" > import="lj.timesheet.Task" > %> > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
The correct core taglib uri for JSTL 1.2 is: http://java.sun.com/jsp/jstl/core Also make sure you're using a Servlet 2.5 web.xml. > <html> > <head> > <title>My Tasks</title> > </head> > > <body> > <h1>My Tasks</h1> > > <table> > <tr> > <th>Description</th> > </tr> > <c:forEach var="task" items="${tasks}"> > <tr> > <td><c:out value="${task.description}" /></td> > </tr> > </c:forEach> > </table> > </body> > </html> > > I had this problem on my Linux desktop which I then rebooted back into > Windows to write this message. Just for kicks, I tossed this JSP onto my dev > server for work (and removed the reference to the Task class) and it worked > no problem. > > The differences I can see between these environments are: > 1. No "Task" import in the environment where it works > 2. Direct call to the JSP in the environment where it works > (rather than calling a servlet which forwards to it) > 3. Slightly different Java version (it's 1.6.0-12 in the > working environment) > 4. Working environment is using CATALINA_BASE to run Tomcat from > a separate directory than the actual distro > > > Can anyone shed any light on this? I'm going to toss my entire WAR file into > the environment where it /is/ working to see if it's some interaction > problem. > > Thanks, > -chris -- Kris Schneider --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org