Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Struts
Iterate Hashmap through struts
pax smith
Ranch Hand
Posts: 45
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi
You can go through this link
http://struts.apache.org/struts-action/faqs/indexedprops.html
Merrill Higginson
Ranch Hand
Posts: 4864
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
<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
Posts: 8
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What if the HashMap was contained in an ArrayList? How would you iterate through the ArrayList, and then iterate through each HashMap inside it?
<logic:iterate id="TheTable" name="myArrayList" type="java.util.ArrayList"> <tr> <logic:iterate id="aRow" name="TheTable"> <logic:iterate id="element" name="aRow"> <logic:equal name="element" property="key" value="myVal"> <td> <bean:write name="element" property="value" /> </td> </logic:equal> </logic:iterate> </logic:iterate> </tr> </logic:iterate>
What's wrong with this code?
madhus mukthas
Greenhorn
Posts: 2
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Not able to get your logic. Instead i am posting a working code below
//ArrayList of employees. //Each employee is a map (e.g. values of map name="bond", age="30") <logic:iterate id="emp" name="empList"> <bean:define id="oneEmp" name="emp" type="java.util.TreeMap"/> <logic:iterate id="empDetail" name="oneEmp"> <br> <bean:write name="empDetail" property="key"/> : <bean:write name="empDetail" property="value"/> <br> </logic:iterate> </logic:iterate>
I am displeased. You are no longer allowed to read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
iterate through a hashMap
HashMap and Vector
re: Iteration in a Map
HashMap in taglib
Nested logic:iterate
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...