JSTL / EL trouble -- How to get size/length of collection
843836Apr 8 2004 — edited Nov 15 2007I am fairly new to using JSTL and EL, so I apologize if this is something obvious to others.
I need to find out the size of an ArrayList that I have inside of my Bean, but I have been unsuccessful. For example, I have a Bean named myBean, and in that Bean is an ArrayList named myList. I am able to access that list, and all of its members just fine in a <forEach> tag, but I have a situation where I need to know the size of the list beforehand.
I have tried using the following, but it doesn't seem to work:
<c:set var="listSize" value="${myBean.myList.size}" />
Can anyone either tell me how to obtain the size of my ArrayList (or any other collection/array for that matter) and explain to me what I am doing wrong?