参见英文答案 How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved13个 我如何使以下代码工作? c:if test="${null != searchResults}" c:forEach items="${searchResults}" var="result" varStatus
我如何使以下代码工作?
<c:if test="${null != searchResults}" > <c:forEach items="${searchResults}" var="result" varStatus="status">
我尝试了许多不同的变体,如:
<c:if test="${searchWasPerformed}" >
要么
<c:if test="<%=request.getAttribute("searchWasPerformed") %>" >
乃至
<% boolean b = null != request.getAttribute("searchResults"); %> <c:if test="${b}" >
哪个看起来真的很丑:/
但我不断得到
org.apache.jasper.JasperException: /WEB-INF/jsp/admin/admin-index.jsp(29,2) PWC6236: According to TLD or attribute directive in tag file, attribute test does not accept any expressions
我该怎么办?
检查您使用的JSTL taglib版本.它应该是1.1,所以你应该有(注意URI):<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>