1、今天,我在用c标签写一些样例,结果出现一些错误,写下作为记录

具体错误如下:

三月 31, 2014 9:46:28 下午 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: 25 in the jsp file: /JSP/forEach.jsp
List cannot be resolved to a type
22: 		<br />
23: 	</c:forEach>
24: 	<%
25: 			List<String> list = new ArrayList<String>();
26: 			list.add("You");
27: 			list.add("Hai");
28: 			list.add("Dong");

An error occurred at line: 25 in the jsp file: /JSP/forEach.jsp
ArrayList cannot be resolved to a type
22: 		<br />
23: 	</c:forEach>
24: 	<%
25: 			List<String> list = new ArrayList<String>();
26: 			list.add("You");
27: 			list.add("Hai");
28: 			list.add("Dong");

Stacktrace:] with root cause
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 25 in the jsp file: /JSP/forEach.jsp
List cannot be resolved to a type
22: 		<br />
23: 	</c:forEach>
24: 	<%
25: 			List<String> list = new ArrayList<String>();
26: 			list.add("You");
27: 			list.add("Hai");
28: 			list.add("Dong");

An error occurred at line: 25 in the jsp file: /JSP/forEach.jsp
ArrayList cannot be resolved to a type
22: 		<br />
23: 	</c:forEach>
24: 	<%
25: 			List<String> list = new ArrayList<String>();
26: 			list.add("You");
27: 			list.add("Hai");
28: 			list.add("Dong");

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:315)
	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、错误原因

由于List是Java中的集合,是java.util.*包中的,因为没有导入这个Java包,导致出现这个错误

3、解决办法

在JSP顶部添加下面这句

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

JSP标签c:forEach报错(二)的更多相关文章

  1. JSP标签c:forEach报错(一)

    1.jsp标签c:forEach报错,具体错误如下: 三月 31, 2014 9:31:14 下午 org.apache.catalina.core.StandardWrapperValve invo ...

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

    今天发现了一个折磨我一天的问题: 在jsp文件中使用 <c:forEach items="${checkResult}" var="item"> & ...

  3. Java Web项目(Extjs)报错二

    1.Java Web项目(Extjs)报错二 具体报错如下: usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ...

  4. JSP标签c:forEach实例

    JSP标签c:forEach实例 1.实例源码 <%@ page language="java" import="java.util.*" pageEnc ...

  5. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>会报错

    有些时候,<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>会报错,错 ...

  6. mybatis foreach报错It was either not specified and/or could not be found for the javaType Type handler

    或许是惯性思维,在mybatis使用foreach循环调用的时候,很多时候都是传一个对象,传一个List的情况很少,所以写代码有时候会不注意就用惯性思维方法做了. 今天向sql传参,传了一个List作 ...

  7. Django 自定义标签与过滤器报错 No module named 'templatetags'

    Django 自定义标签与过滤器报错 按照网上的教程如果想使用自定义的标签与过滤器就得往settings.py中添加下列数据 TEMPLATES = [ { 'BACKEND': 'django.te ...

  8. 【JSP jstl c标签】使用c:foreach 报错(警告)”test does not support runtime expressions“

    后台封装的数据是个list,传递给前台,显示如下: <c:forEach items="${userInfo}" var="user"> 用户Nam ...

  9. jsp动态页面访问报错:HTTP Status 500 - java.lang.NullPointerException,org.apache.jasper.JasperException: java.lang.NullPointerException

    今天把项目导入进去一个新的项目中去结果出现了: org.apache.jasper.JasperException: java.lang.NullPointerException 错误,jsp居然访问 ...

随机推荐

  1. JAVA并发编程学习笔记------基础构建模块

    一.并发容器:ConcurrentHashMap:1.分段锁机制: 任意数量的读取线程可以并发的访问map,执行读取操作的线程和执行写入操作的线程可以并发的访问Map,并且一定数量的写入线程可以并发的 ...

  2. CS231n-lecture2-Image Classification pipeline 课堂笔记

    ---恢复内容开始--- 相关资源  Event Type  Date  Description  Course Materials Lecture 2 Thursday April 6 Image ...

  3. Java基础之Throwable,文件加载

    Java中的异常与错误都继承自Throwable,Exception又分为运行时异常(RuntimeException)和编译时异常. 运行时异常是程序的逻辑不够严谨或者特定条件下程序出现了错误,例如 ...

  4. vue-router 二级路由

    /** * Created by 我 on 2017/12/4. */ import Vue from 'vue' //import导入 Vue(自己起的名) from 从 vue import Vu ...

  5. AC 自动机 模板

    简单版 #include <iostream> #include <cstdio> #include <algorithm> #include <cstrin ...

  6. 百度地图api 区级以下行政区划

    我们在使用百度地图api想要展示苏州市吴中区各乡镇的行政区范围: 百度api有提供了“添加行政区划”的示例:http://lbsyun.baidu.com/jsdemo.htm#c1_10 但该功能目 ...

  7. Validate Model State automatically in ASP.NET Core 2.0

    if (!ModelState.IsValid) { //TODO 模型验证失败需要做的事情 } 上面的代码不管是在传统的ASP.NET还是新一代ASP.NET Core中都是为了验证模型的状态是否合 ...

  8. 简述java中equals()方法和==的区别

    ==与equals的主要区别是: ==: ==常用于比较原生类型(基本数据类型):byte,short,char,int,long,float,double,boolean,比较的是他们的值. 若用= ...

  9. NDK配置debug环境时:Error:FAILURE: Build failed with an exception

    Error:FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:ex ...

  10. PHP常见面试题总结

    1.include 和 require 都能把另外一个文件包含到当前文件中 他们有什么区别?include 和 include_once 又有什么区别? 二者区别只有一个,那就是对包含文件的需求程度 ...