This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Reading from Map in jstl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Reading from Map in jstl" Watch "Reading from Map in jstl" New topic

Reading from Map in jstl

Elizabath Lima
Ranch Hand

Joined: Nov 23, 2005
Posts: 32
Hi all

I'm searching for a solution to get the value (which is a list) from a with a key.
I tried this option
<c:set var ="county" value="${specs.values.parameter.stateid}"/>
where 'parameter.stateid' is my key in the map and 'specs' is my map
and iterating thru the loop using
<c:forEach items="${county}"...

I'm not getting the list from my map using
<c:set var ="county" value="${specs.values.parameter.stateid}"/>

what i can do to resolve this??
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

If I am not mistaken,I don't know why you have "values" in the middle of your EL expression, but if "specs" is a Map then the following two expressions are equivalent:In other words, something in your expression ("values" probably, or maybe "values.parameter.stateid"), is being treated as a literal rather than as property names.
I agree. Here's the link:
subject: Reading from Map in jstl
Similar Threads
forEach nested loop
page 446 target value as array?
Expression Language not evaluating generic Java Map and list as desired
JSF TreeMap Iteration Problem Using JSTL In XHTML
setting hashmap value using jstl