Reputation: 26212
I'm iterating through my map:
I put my map in the controller model attribute like:
model.addAttribute("myMap", realMapObject);
JSP Code:
<c:forEach items="${myMap}" var="entry">
..... works perfectly iteration itself
.....
And I need to check if myMap
entry key is present in another map (anotherMap
). I tried this :
model.addAttribute("anotherMap", realMapObjectAnotherMap);
JSP Code:
<c:forEach items="${myMap}" var="entry">
.....
.....works perfectly
<c:choose>
<c:when test="${not empty ${anotherMap['${entry.key}']}}">
<h2>${entry.key} - YES</h2>
</c:when>
<c:otherwise>
<h2>${entry.key} - NOT</h2>
</c:otherwise>
</c:choose>
I'm getting this error:
contains invalid expression(s): javax.el.ELException: Error Parsing:
Upvotes: 0
Views: 668
Reputation: 1108742
You can't nest EL expressions like ${ ${ } }
. You need to do it in the same single EL expression.
<c:when test="${not empty anotherMap[entry.key]}">
Upvotes: 3