Jim Kennedy wrote:

I figured this one out.  Man, what a landmine.  BTW, good suggestions from
all of you.

Here's what I did:

In my struts config I named the form property "cart".  See below

<form-bean name="shoppingCartForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="cart"
type="com.je.common.ShoppingCartItem[]"/> </form-bean>


Here's the gotcha:  You also have to name the "var" in the loop the exact
same name.  I should have said var="cart"  NOT var="item".  The code works
fine now.  The old code is below.  To fix just change "item" to "cart".  OH,
I also switched to <logic:iterate /> but that should not make any
difference.

Actually, switching to logic:iterate will be different. Taking the code below, as is, and just switching switching "item" to "cart" will not solve all the issues. The logic tag is much more Struts aware and will do different things. Try using both and see the difference (view what the source creates). I believe if you use the JSTL solution, you will have to do it like I mentioned in an early post. logic:iterate (and nested) lets you get away with doing things in a less standard way, but at the price of making it sometimes unclear of what is really going on 'behind the scenes.' I wouldn't use logic:iterate if I was use. The nested tag is nice though for beans that are nested.




<c:forEach var="item" items="${cartitems}">
<tr>
<td><c:out value="${item.id}" /></td> <td><html:text name="item" indexed="true" property="unitPrice"
size="6" /></td> <td><html:text name="item" indexed="true"
property="quantity"/></td>
<%--<td><html:text name="total" value="" size="7"/></td>--%>
</tr>
</c:forEach>


--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to