On Fri, 23 Mar 2001, Sundar @eSaravana wrote:

> Since nobody seemed to have read my long mail, I am re-writing my mail short
> and probably sweet.
> 
> Can I do, multilevel iteration with iterate tag.?
> For example:
> I have collection of beans in my session. In my JSP, I want to first iterate
> at the collection to get the individual beans. And for every bean again
> iterate to get attributes/variables.

There is no current mechanism to iterate over the properties of a bean
(which is what I *think* you meant by attributes/variables).  However, if
your bean had a method that returned all the interesting stuff as a Map or
something like that, you could certainly have a nested iteration over
that.

For example, consider a bean that has a getter method:

        public Map getProperties();

and you had a collection of them called "beans".  Then you can:

<logic:iterate id="bean" name="beans">
  Now processing bean <bean:write name="bean" property="id"/>
  <logic:iterate id="property" name="bean" property="properties">
    Property <bean:write name="property" property="key"/>
    has value <bean:write name="property" property="value"/>
  </logic:iterate>
</logic:iterate>    


> Any help is deeply appreciated.
> 
> Cheers.......................!
> Sundar
> 
> 

Craig


Reply via email to