【问题标题】:<c:choose> tag in JSPJSP 中的 <c:choose> 标记
【发布时间】:2011-05-01 11:24:43
【问题描述】:

如果物品的计数值为0,我想写购物篮是空的。这是我不成功的尝试。我想知道如何做到这一点。

<c:forEach items="${lstCart}" var="cartItem" varStatus="count">
        <form action="Cart" method=Post>
        <tr height="40px">

        <c:choose>
        <c:when test='${count.count} < 1'>

        <td> Shopping Basket is empty! </td>
        </c:when>
        <c:otherwise>

            <td>${count.count}</td>
            <td>${cartItem.productName}</td>
            <td>${cartItem.quantity}</td>   
            <td>${cartItem.unitPrice}</td>
            <td>${cartItem.totalPrice}</td>    
            <td>
            <input type="hidden" name="id" value="${cartItem.productId}" />
            <input type=submit value="x"></td>
            </c:otherwise>
            </c:choose>
        </tr>

        </form>
    </c:forEach>

【问题讨论】:

    标签: jsp jstl jsp-tags


    【解决方案1】:

    关闭,但应该是这样的:

    <c:when test='${count.count < 1}'>
    

    【讨论】:

      【解决方案2】:

      你差不多明白了,应该是

      <c:when test='${count.count < 1}'>
      

      表达式括号应包含整个表达式。

      【讨论】:

        猜你喜欢
        • 2015-01-20
        • 2012-06-08
        • 1970-01-01
        • 1970-01-01
        • 2014-02-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-10-15
        相关资源
        最近更新 更多