You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darryl Nortje <Da...@astrolabegroup.com> on 2002/08/26 16:49:39 UTC

Iterate tag within an iterate tag

Went through the achives to find out if having an iterate tag within an
iterate tag is possible. Didn't find anything.

So basically, my question is 1) is it possible. and 2) if so, how.

This is what I've done, but it's not working......

<logic:iterate name="results" id="collElem">
I am then able to access all this collections getters if they are returning
String via the <bean:write tag like this
<bean:write name="collElem" property="key"/>

if the getter returns a collection, how do I iterate through that result????

the getter in the bean is (in this case) getAttDetails() for the collection
that I now need to iterate through.

If I do this <bean:write name="collElem" property="attDetails"/> in the
first iterate tag it prints out the following to my jsp
[com.ag.armata.contentserver.OptionBean@475d,
com.ag.armata.contentserver.OptionBean@6275], which looks to me like it's
just simply calling the toString() method on the object. What I, in essence
want to do is this....>

<logic:iterate name="results" id="collElem">
    <bean:write name="collElem" property="key"/>
    <logic:iterate name="<bean:write name="collElem"
property="attDetails"/>" id="attDets">
        <bean:write name="attDets" property="key"/> = <bean:write
name="attDets" property="value"/>
    </logic:iterate>
</logic:iterate>
 This obviously does not work.......
Does anyone know how to do what I've tried to explain as best as possible
here.

Thanks
Darryl

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Iterate tag within an iterate tag

Posted by Patrick Roumanoff <sd...@roumanoff.com>.
Selon Darryl Nortje <Da...@astrolabegroup.com>:
> So basically, my question is 1) is it possible. and 2) if so, how.
1) yes
2) here is how...
<logic:iterate name="results" id="collElem">
  <bean:write name="collElem" property="key"/>
  <logic:iterate name="collElem" property="attDetails" id="attDets">
    <bean:write name="attDets" property="key"/> = 
    <bean:write name="attDets" property="value"/>
  </logic:iterate>
</logic:iterate>

and you can go on if you need to iterate on a property of attDets

hope this help
Patrick

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>