What if you add a size property, then put a logic greaterThan (zero) tag
around the iterate tag.
----- Original Message -----
From: "Stanley Tan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 15, 2001 1:56 AM
Subject: Iterate Tag


> Hi,
>
> I have an iterate tag that loops through the items in a shopping
> cart.  Now, everything is working fine UNLESS I view the page when the
> shopping cart is empty.
>
> <logic:iterate id="shoppingcartitem" name="cart" property="products">
>      <tr bgcolor="<jsp:getProperty name="color" property="next"/>">
>          <td><bean:write name="shoppingcartitem"
> property="product.productID"/></td>
>          <td><bean:write name="shoppingcartitem"
> property="product.productName"/></td>
>          <td align="center"><bean:write name="shoppingcartitem"
> property="quantity"/></td>
>          <td align="center"><bean:write name="shoppingcartitem"
> property="product.productPrice"/></td>
>      </tr>
> </logic:iterate>
>
> When it is empty, I get
>
> javax.servlet.jsp.JspException: Cannot create iterator for bean cart and
> property cart at
> org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:317)
> at _jsp._stan1._viewcart__jsp._jspService(/stan1/viewcart.jsp:50)
>
> What can I do?  Any suggestions?
>
> Thanks in advance,
>
> Stanley
>
>

Reply via email to