On Sun, 25 Mar 2001, Sundar @eSaravana wrote:

> >
> >
> > On Sat, 24 Mar 2001, Sundar @eSaravana wrote:
> >
> > > Hi,
> > >
> > > This is my situation:
> > > I have a collection(Vector) of buddyListForm as session attribute.
> > >
> > > So, in my JSP,
> > >
> > > <logic:iterate id="buddylist" property="buddylist" scope="session"> <!--
> > > vector being iterated -->
> >
> > If the Vector you are storing is under session key "buddyListForm", this
> > should really say something like:
> > <logic:iterate id="buddy" name="buddylist" scope="session">
> >
> 
> Nope, the vector of buddyListForm is under the session key "buddylist".
> So just for clarity I modified my current code as following:
> 
> <logic:iterate id="buddy" property="buddylist" scope="session"> <!-- fetches
> the vector from session under key "buddylist -->
> <logic:iterate id="buddy1" property="buddy" scope="session"> <!-- individual
> bean -->
> <tr>
>     <bean:write name= "buddy1"  property="name" filter="true"/>
> </tr>
> </logic:iterate>
> </logic:iterate>
> 

What I still don't understand is why are you using two nested iterate
tags?  You only need one tag to iterate over the contents of a Vector.

If you have a session attribute named "buddylist" that is a Vector,
iterate over it like this:


<table>
<logic:iterate id="buddy" name="buddylist" scope="session">
  <tr>
    <td><bean:write name="buddy" property="name" filter="true"/></td>
  </tr>
</logic:iterate>
</table>

Note that you refer to buddylist with a *name* attribute, not a *property*
attribute.

Craig

Reply via email to