<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<c:forEach begin="1" end="10" var="i">
${i }<br />
</c:forEach>
</body>
</html>
如上,在Jsp中使用了foreach等jstl/core中的语法,结果一运行就报错,报错为:
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files
造成报错的原因是:web项目中没有jstl标签库的相关jar包造成的,也就是缺少jstl.jar和 standard.jar这两个jar包才造成这个问题的
解决方法:在项目中导入jstl.jar和standard.jar这两个jar包,然后再重启下tomcat服务器即可·