There is such method you described since Thymeleaf version 1.0 which works for me as expected (see documentation). Maybe your Map
key isn't String
value or myStringValue
isn't String
.
Did you tried use constant String
as key?
<span th:if="${#maps.containsKey(myMap, 'valueOfMyStringValue')}">YEAH!</span>
Or call Map#containsKey
method directly on Map
?
<span th:if="${myMap.containsKey('valueOfMyStringValue')}">YEAH!</span>