This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes iterating over hashmap using jstl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "iterating over hashmap using jstl" Watch "iterating over hashmap using jstl" New topic
Author

iterating over hashmap using jstl

Saniya Ansari
Ranch Hand

Joined: Sep 30, 2002
Posts: 48
Hi - i have a simple issue but a little new with JSTL.
I have a hashmap which contains a key (string value) and value (array list). I need to iterate such that i populate a html drop down list. The key will be displayed, the arraylist[0] and arraylist[1] values will be displayed as text on the HTML page.

Can anyone show me a simple example ....thanks!


SCJP 2
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

What have you worked out so far?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Saniya Ansari
Ranch Hand

Joined: Sep 30, 2002
Posts: 48


this is what i have so far... but i'm wondering on how to get something like pet.value[0] (refering to the first value in the array list)
and then pet.value[1] i.e. the second value...
Should i extract out the array list as a variable using the <c:set> tag and print the value at index 0 and 1 from that...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Please edit your post and add proper indentation to the code. Thanks.
 
 
subject: iterating over hashmap using jstl
 
Similar Threads
List boxes
JSTL printing issue
optionsCollection display query
Records in Arraylist
How to print the elements of an arraylist that contains a hashmap