开发者

<c:choose> tag in JSP

开发者 https://www.devze.com 2023-03-01 16:36 出处:网络
I want to write Shopping basket is empty if count value of items inis 0. Here was my unsuccessful attempt. I was wondering how to do this.

I want to write Shopping basket is empty if count value of items in 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>
        <开发者_JAVA百科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>


Close, but it should be this:

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


You almost got it, it should be

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

The expression parentheses should encompass the entire expression.

0

精彩评论

暂无评论...
验证码 换一张
取 消