Access hashmap value by variable in JSP -
i have hashmap, put request:
hashmap<integer, string> mymap = ... request.setattribute("mymap", mymap);
in jsp have foreach loop
<c:foreach items="${list}" var="item" varstatus="status"> <c:out value="${item.description}"/> <c:out value="${mymap[item.id]}"/> </c:foreach>
but ${mymap[item.id]}
not work. how can access hashmap's value item.id
variable ?
in el, numbers treated long
. change map
map<long, string>
, it'll work.
Comments
Post a Comment