Ignacio Martínez
Ignacio Martínez

Reputation: 702

Get value by key inside a Map<String, Map<String, Double>> JSP

I have a

Map<String, Map<String, Double>>

and I'd like to get the Double value by some given keys. I've found that it can be done using "c:foreach" but I want to find some values, I don't want to iterate all of them. It would be something like:

myMap['myKey']['myAnotherKey']

How can I do this?

Upvotes: 1

Views: 300

Answers (2)

if you know the keys

Double val = myMap.get(myKey).get(myAnotherkey);

Upvotes: 0

Jigar Joshi
Jigar Joshi

Reputation: 240918

Try this

<c:out value="${myMap['myKey']['myAnotherKey']}"/>

Upvotes: 1

Related Questions