Panasonic Youth

Getting size of collection in JSTL 1.0

Assuming JSTL 1.0, this doesn’t work:

<c:out value="${myMap.size}" />

and neither does this

<c:set var="mapSize" value="${myMap.size}" />
<c: out value="${mapSize}" />

I’m assuming JSTL wants to find something called getSize()… So is this the only way to do it?

<%=((java.util.Map) pageContext.findAttribute("myMap")).size() %>

(meta note: if I actually get all the HTML escape codes right for this, I will be amazed)