The value attribute for the iterator tag can be either a Collection or an
Interator. If it is a map, then each entry is going to be a
Map.Entryobject, with a key and a value.

<s:iterator id="entry" value="[EMAIL PROTECTED]@{'name':'John
Galt'}">
 <s:property value="key"/> - <s:property value="value"/>
</s:iterator>

should print:

name-John Galt

musachy

On 4/23/07, Felipe Rodrigues <[EMAIL PROTECTED]> wrote:


I'm not so sure if you can iterate over a Map. Even in Plain Old Java Code
you can't do that.
A good solution is create a keySet or a list from Map's keys and iterate
over that, using each object to get the Map values.

Good look,


Felipe



meeboo wrote:
>
> Hey all
>
> How do I iterate through a map? My current method returns a
> LinkedHashMap<String, Movie> - the map is populated and accessed by the
> view as my debugger shows, but it is never iterated through. Here's the
> JSP fragment
>
> <s:iterator value="aMovieFromEachCategory">
>       <p>Should iterate 12 times</p>
> </s:iterator>
>
> Thanks!
>

--
View this message in context:
http://www.nabble.com/Iterating-through-a-map-tf3633177.html#a10145984
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Reply via email to