On Wed, 30 Oct 2002, David Graham wrote:
> Date: Wed, 30 Oct 2002 09:13:49 -0700 > From: David Graham <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: [OT] Getting a Collection's size in JSTL > > Sorry for the OT post but the java forum was unresponsive. How do you get > the size of a collection class in the JSTL EL? > > You can do it with jsp expressions like: > <%= collection.size() %> > > but I want to do something like > > <c:if test="${collection.size > 0}"> > This does not work because the size() method does not follow the naming pattern required for JavaBean properties (where it would be getSize()). One option would be to make yourself a subclass of things like ArrayList that simply delegated everything, but added a getSize() method that calls size() under the covers. > I've tried every variation on that syntax that I could think of. > > Thanks, > David > Craig -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>