Now that I understand my problem a little better, maybe I can explain it a
little better.
My form bean, named ItemList, contains a collection of objects named
itemList. Each member of itemList contains a collection of objects named
prices. Each member of prices contains a string named price, which I want to
display and collect.
So I wrote this:
<c:forEach items="${ItemList.itemList}" var="itemList">
<tr>
<c:forEach items="${itemList}" var="prices">
<td>
<html-el:text name="prices" property="price" indexed="true"/>
</td>
</c:forEach>
</tr>
</c:forEach>
This worked fine for displaying the prices, but would not submit properly.
It turned out that each text item got a name property of "prices[n].price",
and Struts could not properly build the bean with this information. Since I
knew that the "prices" collection always had exactly five members, I coded
this:
<c:forEach items="${ItemList.itemList}" var="itemList">
<tr>
<td><html-el:text name="itemList" property="prices[0].price"
indexed="true"/></td>
<td><html-el:text name="itemList" property="prices[1].price"
indexed="true"/></td>
<td><html-el:text name="itemList" property="prices[2].price"
indexed="true"/></td>
<td><html-el:text name="itemList" property="prices[3].price"
indexed="true"/></td>
<td><html-el:text name="itemList" property="prices[4].price"
indexed="true"/></td>
</td>
</tr>
</c:forEach>
Now each text item has a name of the form "itemList[n].prices[n].price".
Struts can handle this on submission and it works well.
But it only works because I know there are always exactly five prices. Is
there a way to handle this with nested loops that will work regardless of
the size of the array?
--
Tim Slattery
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]