您的位置:首页 > 运维架构 > Apache

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

2016-03-12 21:26 633 查看
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多了,如果是别的错误,此中方法不管用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jsp错误 jsp jstl