struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Yang <kenshin...@gmail.com>
Subject Re: Iterate through a List of Maps
Date Tue, 14 Dec 2010 02:41:49 GMT
yes try adding "#" before "record" -> "#record"

and since record is a map you can iterate through it directly without
calling entrySet()

On Tue, Dec 14, 2010 at 10:36 AM, Dave Newton <davelnewton@gmail.com> wrote:

> What version? Early versions sometimes required a "#" before the
> variable name when referencing vars defined by things like an iterator
> tag.
>
> Dave
>
> On Monday, December 13, 2010, JOSE L MARTINEZ-AVIAL <jlmagc@gmail.com>
> wrote:
> > Hello all, I'm trying to iterate through a List of Maps(I have a method
> > "public List<Map> getRecords()" in the action) using s:iterator. I can
> > iterate through the List without problems, but I can not get it to
> iterate
> > through the entries of the map. So far I've got this:
> >
> > [..]
> > <s:iterator value="records" status="recordsStatus" var="record">
> >         <s:if test="#recordsStatus.index ==0">
> >             <tr>
> >                 <td colspan="*"></td>
> >             </tr>
> >         </s:if>
> >         <tr>
> >             <s:iterator value="record.entrySet()" status="fieldStatus">
> >             <td>
> >                 <s:property value="key"/>/<s:property value="value"/>
> >             </td>
> >             </s:iterator>
> >         </tr>
> >     </s:iterator>
> > [..]
> >
> > The tag generates the
> >
> > <tr></tr>
> >
> > for each entry, but it is not going through the second iterator, so I
> > suppose I'm doing something wrong with the value attribute. Can you help
> me
> > with it?
> >
> > Thanks
> >
> > Jose
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message