I am working on jsp, and facing some syntax related issue (that's what I think it is). So, my jsp code has a map that is pushed to jsp through ModelAndView as a Map. In jsp, I want to compare the map.key to a string, if it is equal, then display, otherwise skip that map.key and continue with others.
Code snippet:
<c:forEach items = "${maker_model.kycPoiRejectionCodeMap}" var = "reasonEntry" >
<c:if test= "${reasonEntry.key eq 'stringToCompare'}">
//Show reasonEntry.value this if reasonEntry.key is 'stringToCompare'
</c:if>
<c:otherwise>
//else this
</c:otherwise>
</c:forEach>
<c:if test= "${reasonEntry.key eq 'stringToCompare'}">
is not working. I have tried <c:if test= "${reasonEntry.key == 'stringToCompare'}">
and this too did not work.
I have already gone through the question: compare-map-keys-with-some-element-and-based-on-the-result-show-its-values and hash-map-key-check-in-jstl but in the solution they have removed the comparison itself and in the 2nd, I am doing same as suggested. I have also searched for other questions but did not find any leads.
Maybe useful: Maybe useful: Values in reasonEntry.key are extracted from enum::name (name() method of Enum.java).
Can someone let me know how to fix this?