Reputation: 43
mvc, jsp and bootstrap in which i am passing 2 model attributes
model.addAttribute("map",map)
model.addAttribute("size",SIZE)
now on the jsp i want to iterate over this map and want to check if map value matches the SIZE varibale value for which i tried below syntax
<div id="selector" class="btn-group">
< c:forEach items="${maps}" var="buttonName" varStatus="counter">
<div class="row">
<div class="col-sm-8">
<c:if test="${buttonName.key} == ${SIZE}">
<button type="button" id="a" >cat</button>
</c:if>
< /div>
< /div>
< br/>
< /c:forEach>
< /div>
but this is not working , please let me know if the if syntax is correct ?
Upvotes: 1
Views: 61
Reputation: 7383
${}
is not used to enclose a single variable but the whole statement. And you should use eq
instead of ==
. So the correct syntax is:
${buttonName.key eq SIZE}
Upvotes: 3