Sorry, I know this seems similar to other questions but I still can't work out the solution.
I have a LinkedHashMap<Long,ExperimentMetadata> metadata
set as a session attribute. (ExperimentMetadata is a javabean.) I want to get an attribute from a specific bean whose key is the parameter metadata_key. But when I try to get this directly, e.g.
<c:out value="${metadata[param.metadata_key].name}" />
the result is blank.
However, when I iterate over the whole map it works fine e.g.
<c:forEach items="${metadata}" var="exp">
<c:if test="${exp.key eq param.metadata_key}">
<c:out value="${exp.value.name}" />
</c:if>
</c:forEach>
Which I can do but it kind of defeats the purpose of using a hashmap. It also works if I do e.g.
<c:out value="${metadata[1].name}" />
Can anyone help suggest what the problem is and how to fix it? Thankyou!