tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <David.K...@wamu.net>
Subject RE: how to ask length of collection in JSTL tags
Date Tue, 15 Jul 2003 15:15:55 GMT
As you may know by now, the EL in this version only allows you to access
javabean properties, and collection and map entries.  You can't directly
get the length of a map or collection.

What I've done recently is implement a small class called
"CollectionBean" which has two javabean properties of "collection" and
"size".  You create a CollectionBean with a collection.  Put the
collectionBean in a scope accessible to your page and reference the
properties in your EL references.  You can do the same thing for
"MapBean".

> -----Original Message-----
> From: Dmitri Ilyin [mailto:dmitri.ilyin@gmx.net]
> 
> Hi,
> 
> how can i get the length(size) of the collection??
> I have a collection in page scope and i'd like to check the length of
this
> collection.
> I use <c:if test="${collection.length == 1}">
>             that's it
>          </c:if>
> "collection.length" returns always 0. the same with "collection.size"
and
> "collection.itemCount"
> 
> HELP!!
> 
> thanks a lot
> 
> regards
> 
> Dmitri
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message