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

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

时间: 2024-10-10 23:47:39

JSP标签c forEach报错(一)的相关文章

jsp使用c:forEach报错 javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext的问题

今天发现了一个折磨我一天的问题: 在jsp文件中使用 <c:forEach items="${checkResult}" var="item"> </c:forEach> 一直报错: [ERROR] 2013-12-09 15:03:20,740 method:org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:253) Servlet.

JSP标签c forEach实例

JSP标签c:forEach实例 1.实例源码 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%> <!DOCTYPE html PUBLIC "-//W3C/

Python自动化之下拉框,隐藏标签定位 代码&报错解决

python自动化:下拉框定位方法之select标签 style="display: none;"报错selenium.common.exceptions.ElementNotVisibleException: Message: element not visible: Element is not currently visible and may not be manipulated 界面源码:(禅道为例)排查:1)因为是隐藏的,需要操作其可见才可定位 2)若还是无法定位,请查看前

Foreach报错

List<String> a = new ArrayList<String>(); 2 a.add("1"); 3 a.add("2"); 4 for (String temp : a) { 5 if("1".equals(temp)){ 6 a.remove(temp); 7 } 8 } 此时执行代码,没有问题,但是需要注意,循环此时只执行了一次.具体过程后面去分析.再来看一段会出问题的代码: List<Strin

jsp标签&lt;c:forEach&gt;取出传递参数注意

运行书里的代码,其中servlet可以通过以下两个方式向jsp传参数: 1.         request.getSession().setAttribute("productList",productList); response.sendRedirect("displayAllProduct_3.jsp"); 2. request.setAttribute("productList", productList); RequestDispat

Angularjs 中的iframe 标签 ng-src 路径 报错问题 解决办法

iframe中的src直接替换成ng—src不可以,需要转换一下.Angular里面有个属性是专门用来解决跨域问题的 $sce. PS:$sce ($sce服务把一些地址变成安全的.授权的链接..)常用的方法有: $sce.trustAs(type,name); $sce.trustAsHtml(value); $sce.trustAsUrl(value); $sce.trustAsResourceUrl(value); $sce.trustAsJs(value);   $scope.someU

ionic 项目中,video标签添加ng-src报错(

1.添加过滤器,以及常见过滤器 //向网页中添加html代码,需要被信任mpFilters.filter('to_trustHtml', ['$sce', function ($sce) { return function (text) { return $sce.trustAsHtml(text); } }]); //向网页中展示地址,需要被信任 mpFilters.filter('to_trusted', ['$sce', function ($sce) { return function

JSP页面java代码报错:Purgoods cannot be resolved to a type

错误提示 : Purgoods cannot be resolved to a type Purgoods不能解析为一个类型 原因 : 缺少引入Purgoods类 原文地址:https://www.cnblogs.com/mangwusuozhi/p/9542307.html

MyEclipse中jsp的注释报错解决

jsp页面中注释报错: 出错现场:在eclipse中没有报错,在MyEclipse中报错. <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. --> Myeclipse的js中不会识别这样的标识 需要改成: //  To use express install, set to playerProductInstall.swf, otherwise the empty