JSP标签c forEach报错
Posted odejsjhshw
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JSP标签c forEach报错相关的知识,希望对你有一定的参考价值。
1、jsp标签c:forEach报错,具体错误如下:
三月 31, 2014 9:31:14 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [jsp] in context with path [/HighCharts] threw exception [Unable to compile class for JSP:
An error occurred at line: 17 in the jsp file: /JSP/forEach.jsp
Syntax error on token ""O"", delete this token
14: <hr>
15: <%
16: String[] array = { "A", "B", "C", "D", "E", "F","G","H","I","J","K","L","M","N"
17: "O","P","Q","R","S","T","U","V","W","X","Y","Z"};
18: request.setAttribute("array", array);
19: %>
20: <c:forEach items="${array}" var="arr">
Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 17 in the jsp file: /JSP/forEach.jsp
Syntax error on token ""O"", delete this token
14: <hr>
15: <%
16: String[] array = { "A", "B", "C", "D", "E", "F","G","H","I","J","K","L","M","N"
17: "O","P","Q","R","S","T","U","V","W","X","Y","Z"};
18: request.setAttribute("array", array);
19: %>
20: <c:forEach items="${array}" var="arr">
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
2、错误原因
由于在数组中缺少逗号,导致错误发生
String[] array = { "A", "B", "C", "D", "E", "F","G","H","I","J","K","L","M","N"
"O","P","Q","R","S","T","U","V","W","X","Y","Z"};
3、解决办法
在“N”后加上逗号
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow
以上是关于JSP标签c forEach报错的主要内容,如果未能解决你的问题,请参考以下文章
如何在 JSP 页面的脚本标签中使用 <c:forEach>?