Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterate Hashmap through struts

 
pax smith
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
You can go through this link
http://struts.apache.org/struts-action/faqs/indexedprops.html
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<logic:iterate id="element" name="myHashMap">
Key is <bean:write name="element" property="key" />
Value is <bean:write name="element" property="value" />
</logic:iterate>
 
Chris Rutkowski
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not able to get your logic. Instead i am posting a working code below

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic