小编Eri*_*rik的帖子

如何使用JSTL"if"标记而不得"..attribute test不接受任何表达式"

我如何使以下代码工作?

        <c:if test="${null != searchResults}" >
            <c:forEach items="${searchResults}" var="result" varStatus="status">
Run Code Online (Sandbox Code Playgroud)

我尝试了很多不同的变体,例如:

<c:if test="${searchWasPerformed}" >
Run Code Online (Sandbox Code Playgroud)

要么

<c:if test="<%=request.getAttribute("searchWasPerformed") %>" >
Run Code Online (Sandbox Code Playgroud)

乃至

<% boolean b = null != request.getAttribute("searchResults"); %>
    <c:if test="${b}" >
Run Code Online (Sandbox Code Playgroud)

看起来真的很丑:/但我继续得到了

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
Run Code Online (Sandbox Code Playgroud)

我该怎么回事呢?

jsp jstl el

14
推荐指数
1
解决办法
1万
查看次数

标签 统计

el ×1

jsp ×1

jstl ×1