码迷,mamicode.com
首页 > Web开发 > 详细

JSP标签c forEach报错(一)

时间:2019-02-16 15:06:07      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:items   toc   nal   setattr   port   pac   work   老师   cat   

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报错(一)

标签:items   toc   nal   setattr   port   pac   work   老师   cat   

原文地址:https://www.cnblogs.com/odejsjhshw/p/10387763.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!