<%-- 这个不配置tld就出错 --%> <c:forEach var="c" items="${cookie}"> key:${c.key}, value: ${c.value}<br> </c:forEach>cookie.jsp(40,0) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> -------------------------------------这条语句不需要.. <c:forEach begin="1" end="10"> a<br> </c:forEach>但是上面调用${cookie}的不加就出这个错误. cookie.jsp(40,0) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
像c标签都是在Jar包里的,你只需要在使用的页面里导入就可以了呀。
如:<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:forEach var="c" items="${cookie}">
key:${c.key}, value: ${c.value}<br>
</c:forEach>cookie.jsp(40,0) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
-------------------------------------这条语句不需要..
<c:forEach begin="1" end="10">
a<br>
</c:forEach>但是上面调用${cookie}的不加就出这个错误.
cookie.jsp(40,0) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
key:${c.key}, value: ${c.value}<br>
</c:forEach>这个不能输出全部cookie对象,c.value表示的是cookies名字,不是key对应的value值..
怎么表示?
+1, 请检查web.xml的头部信息是否为servlet2.3, 如果不是请换成2.4就可以支持你的第一种写法。
servlet2.3是不支持EL标签的,楼主的第一种写法需要2.3的jstl-el支持