在jsp中用JSTL标签迭代集合中元素,却出现这个异常:
org.apache.jasper.JasperException: /WEB-INF/jsp/home.jsp(3,62) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
/WEB-INF/jsp/home.jsp(3,62)文件如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
${phonetic}
<br />
${eetymologies}
<c:forEach items="${eetymologies}" var="eetymology">
${eetymology.word}
${eetymology.eetymology}
</c:forEach>
<br />
${cetymology}
</body>
</html>
该jsp文件中没有错误;在项目中已经导入了JSTL需要的jar文件,也把jar文件放进了/WEB-INF/lib/中。后来发现把服务器改为Tomcat7,异常就消失了。
之前用的是J2EE Preview:
来源:CSDN
作者:云聪
链接:https://blog.csdn.net/l294265421/article/details/46122259