Just read from the WW in action book - 

"One of the nicest features about the iterator tag is that it can iterate
over just about any data type that has a concept of iteration. When
iterating over a Map, it iterates over the Set returned by Map.entrySet(),
which is a set of Map.Entry
objects, which in turn has the methods getKey() and getValue() to retrieve
the associated key/value pairs."

The key to retrieving the values is to use <s:property value="key"/> and
<s:property value="value"/>


Felipe Rodrigues 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#a10146427
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to