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
This week's book giveaway is in the
Open Source Projects
forum.
We're giving away four copies of
Eclipse Collections Categorically: Level up your programming game
and have Donald Raab on-line!
See
this thread
for details.
Win a copy of
Eclipse Collections Categorically: Level up your programming game
this week in the
Open Source Projects
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
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Struts
Iterate Hashmap through struts
pax smith
Ranch Hand
Posts: 45
posted 19 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 19 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 19 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 19 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 15 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’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
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...