On Mon, 5 Feb 2001, Vardar, Tuna wrote:

> hi.
> 
> how can I handle nested structures using Struts?
> what I want to do is sth. like :
> 
> <ul>
> <logic:iterate id="item1" name="coll1">
>     <li><bean:write name="item1" property="pro1"><li>
>            <ul>
>                <!--a check here if coll2.pro2 = coll1.pro1  ??? -->
>                <logic:iterate id="item2" name="coll2">
>               <li><bean:write name="item2" property="pro3"></li>
>          </logic:iterate>
>            </ul>
> </logic:iterate>
> </ul>
> 
> I tried some combinations but couldn't succeeded.
> any comments?
> 

 I was just hacking around with the same (or at least a similar) thing. I
have an ArrayList that contains a String[] in each element. In the
Action class, I saved the array list in request scope with:

request.setAttribute("tableValues", arrayList);


Here's a JSP snippet of what I used to print the ArrayList in an HTML
table:

<jsp:useBean 
id="tableValues" scope="request" class="java.util.ArrayList"/>

...

<table>
<logic:iterate id="item" name="tableValues">
  <tr>
  <logic:iterate id="element" name="item" >
    <td>
    <bean:write name="element"/>
    </td>
  </logic:iterate>
  </tr>
</logic:iterate>
</table>
...

Hope this helps.

Reply via email to