wood burning stoves 2.0*
The moose likes Struts and the fly likes Iterate Hashmap through struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iterate Hashmap through struts" Watch "Iterate Hashmap through struts" New topic
Author

Iterate Hashmap through struts

pax smith
Ranch Hand

Joined: Dec 13, 2005
Posts: 45
Hi

Can anybody give me the sample code to iterate a hashmap in which I have a key and a string in the value field

Thanks
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
Hi
You can go through this link
http://struts.apache.org/struts-action/faqs/indexedprops.html
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
<logic:iterate id="element" name="myHashMap">
Key is <bean:write name="element" property="key" />
Value is <bean:write name="element" property="value" />
</logic:iterate>


Merrill
Consultant, Sima Solutions
Chris Rutkowski
Greenhorn

Joined: Jun 26, 2006
Posts: 8
What if the HashMap was contained in an ArrayList? How would you iterate through the ArrayList, and then iterate through each HashMap inside it?



What's wrong with this code?
madhus mukthas
Greenhorn

Joined: Oct 24, 2009
Posts: 2
Not able to get your logic. Instead i am posting a working code below

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Iterate Hashmap through struts
 
Similar Threads
HashMap and Vector
iterate through a hashMap
HashMap in taglib
Nested logic:iterate
re: Iteration in a Map