2011-05-01 53 views
4

我想寫如果計數值的值爲0,那麼購物籃是空的。這是我不成功的嘗試。我想知道如何做到這一點。<c:choose> JSP中的標記

<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> 

回答

3

你幾乎得到了它,它應該是

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

表達括號應包括整個表達式。

4

關閉,但它應該是這樣的:

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