Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSTL / EL trouble -- How to get size/length of collection

843836Apr 8 2004 — edited Nov 15 2007
I 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?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2007
Added on Apr 8 2004
8 comments
753 views