tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Cai <Jeff_...@symantec.com>
Subject c:forEach doesn't support variable in Tomcat 7.0.54 while 7.0.37 supports
Date Thu, 05 Jun 2014 09:50:56 GMT
Hi, 

In tomcat 7.0.54, the variable is not supported.
I changed the source apache-tomcat-7.0.54/webapps/examples/jsp/tagplugin/foreach.jsp

    <c:set var="num" value="20" />
    <c:forEach var="item" begin="1" end="{$num}">
        ${item}
    </c:forEach>

Then it reports:

org.apache.jasper.JasperException: Unable to compile class for JSP
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:672)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause

java.lang.NumberFormatException: For input string: "{$num}"
	java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	java.lang.Integer.parseInt(Integer.java:492)
	java.lang.Integer.valueOf(Integer.java:582)
	org.apache.jasper.compiler.JspUtil.coerceToInt(JspUtil.java:605)
	org.apache.jasper.compiler.Generator$GenerateVisitor.convertString(Generator.java:3184)
	org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:3001)
	org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:3106)
	org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomStart(Generator.java:2276)
	org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1768)
	org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1538)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2429)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2435)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:474)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377)
	org.apache.jasper.compiler.Generator.generate(Generator.java:3517)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:250)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


I did same tests on Tomcat 7.0.37 and this error did not happen.

Jeff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message