2017  Kodetalk | Feedback | Privacy Policy | Terms | About

EL access a map value by Integer key

I have a Map keyed by Integer which I want to access the key by using EL

Map<Integer, String> map = new HashMap<Integer, String>();
map.put(1, "Apple");
map.put(2, "Mango");
map.put(3, "Orange");

I am using the below snippet but failure.Plesae suggest...
<c:out value="${map[1]}"/>

Use below snippet.

<c:out value="${map[(1).intValue()]}"/>
Answer is