Struts: List in a List

Hi All,

I have a requirement where I have a List consisting of Lists. This inner lists will have beans. I need to display amounts from the beans.

I could successfully display the amounts by using two "logic:iterate"'s

In the code below amountsForm is my ActionForm, amountsList is the parent list containing List's of beans (amount is my bean)

<logic:iterate id="list" name="amountsForm" property="amountsList">

<tr>

<logic:iterate id="amount" name="list">

<td class="field_label" width="149"><bean:write name="amount" property="desc" /></td>

<td><html:text indexed="true" name="amount" property="amount" style="WIDTH: 80px; text-align: right;" /></td>

</logic:iterate>

</tr>

</logic:iterate>

But user can edit the amounts and I have to update the same in the database. Now how can I get the values back into the form populated?

Your help is greatly appreciated.

Thanks.

[1324 byte] By [talk2keya] at [2007-11-27 10:24:43]
# 1

There are techniques to do what you need using a List of object, but a List inside a List I have never tried before, not sure if that is possible but I'm sure you could try.

Take a look at my responses in here as a start.... http://forum.java.sun.com/thread.jspa?threadID=5174805

den2681a at 2007-7-28 17:29:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks Den. I too changing my design to make is a simple list of beans instead of lists in a list.

If I have time I will try the option again and post the results if successful.

talk2keya at 2007-7-28 17:29:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...