You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Prem Kumar Ponnuraj <pr...@wipro.com> on 2001/12/31 04:21:11 UTC
How do I use nested collections with iterate tag
Hi,
I have an ArrayList of ArrayList:
ArrayList objScreenDetailsContainer = new ArrayList();
ArrayList objRowDetails = new ArrayList();
objRowDetails.add("Hello1");
objRowDetails.add("Hello2");
objScreenDetailsContainer.add(objRowDetails);
objRowDetails = new ArrayList();
objRowDetails.add("World1");
objRowDetails.add("World2");
objScreenDetailsContainer.add(objRowDetails);
I have set the objScreenDetailsContainer object to the form bean.
Could you give an idea of how to get this collection from the form bean
to the iterate tag(I'm not setting that object in the request).
My display requirement is this :
<table>
<tr>
<td><input type="radio" name="D1" value="<the index of the
ArrayList>"></td>
<td>Hello1</td>
<td>Hello2</td>
</tr>
<tr>
<td><input type="radio" name="D1" value="<the index of the
ArrayList>"></td>
<td>World1</td>
<td>World2</td>
</tr>
</table>
The problems faced are :
Not able to get the object from the bean (applcation scope)thru' iterate
tag.
Not able to get the indexId of the ArrayList and set it as value to the
radio.
Don't have idea of how to get the inner ArrayList and iterate.
the code for this will be of much help.We want to achieve this with tags
alone.We don't want to use scriptlets.
Rgds,
Prem