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
Win a copy of
TDD for a Shopping Website LiveProject
this week in the
Testing
forum!
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
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
Struts
Iterate Hashmap through struts
pax smith
Ranch Hand
Posts: 45
posted 16 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 16 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 16 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 15 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 12 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>
this llama doesn't want your drama, he just wants this tiny ad for his mama
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
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...