【问题标题】:JSTL - if condition [duplicate]JSTL - 如果条件 [重复]
【发布时间】:2016-05-07 16:18:32
【问题描述】:

如何在JSTL中使用if?我想做这样的事情。

<c:if  ${order.products} == NULL>
a
else
b
</c:if>

【问题讨论】:

    标签: jstl


    【解决方案1】:

    我相信语法是这样或类似的。

    <c:choose>
    <c:when test="${order.products == null}">
    a
    </c:when>
    <c:otherwise>
    b
    </c:otherwise>
    </c:choose>
    

    【讨论】:

    • 应该是&lt;c:if&gt;而不是&lt;c:when&gt;
    【解决方案2】:

    试试这个:

    <c:choose>
     <c:when test="${order.products == null}">
      a
     </c:when>
     <c:otherwise>
      b
     </c:otherwise>
    </c:choose>
    

    【讨论】:

      猜你喜欢
      • 2017-04-12
      • 2014-11-16
      • 1970-01-01
      • 2016-05-21
      • 2017-01-14
      • 1970-01-01
      • 2011-09-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多