我如何使以下代码起作用?
<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" %>