Is there any way to get the size of a Map using JSTL ? I tried with ${myMap.size} but it's not working..
got the solution: Use jstl functions.
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
then use like this:
<c:if test="${fn:length(myMap) > 1 }">
${myMap.size}
isn't working because it gets translated to myMap.getSize() by the EL parser.
Try:
${myMap.size()}
It should work.
The JSTL length function works on a Collection
but not sure if it will work on a Map
. Might be worth a try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With