<C: select> tag in JSP

I want to write Cart basket is empty if the item count value is 0. Here was my unsuccessful attempt. I was wondering how to do this.

<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> 
+4
source share
2 answers

Close, but it should be like this:

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

You almost got it, it should be

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

The expression brackets must span the entire expression.

+3
source

All Articles