org.apache.jasper.JasperException: Unable to compile class for JSP:

The method setItems(String) in the type ForTokensTag is not applicable for the arguments (Object):

无意间学习JSTL的时候出了这个错,花了很长时间,在网上也百度好久,发现报org.apache.jasper.JasperException: Unable to compile class for JSP:错误的好多,但是真正和我的出错有关的是下面内容的第一行报错,所以这里我把它复制下来写到第一行,

代码如下:

<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="c" uri="
http://java.sun.com/jsp/jstl/core"%>
<html>
<body>
<h2>Hello World!</h2>
<c:forTokens items="我,在,上,海,你,在,哪" delims="," var="val">
<c:out value="${val}"></c:out>
<br />
</c:forTokens>
<hr />
</body>
</html>

报错页面如下


经过几个小时的奋斗,终于找到原因,原来是我的jstl.jar多了,javaEE Libraries 本身含有jstl.jar,我自己又添加了jstl.jar包,

导致报出此类错误,如果报出org.apache.jasper.JasperException: Unable to compile class for JSP错误,首先要看看紧跟着的错误是什么,就像我的错误是The method setItems(String) in the type ForTokensTag is not applicable for the arguments (Object):最后发现是jstl.jar多了,如果是别的错误,此中方法不管用。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章