tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Geary <>
Subject Re: set Collection size
Date Thu, 05 Sep 2002 16:16:10 GMT
Karr, David wrote:

>>-----Original Message-----
>>From: Hari Mukkala []
>>Sent: Thursday, September 05, 2002 7:26 AM
>>To: Tag Libraries Users List
>>Subject: c:set Collection size
>>I am trying to get the size of a collection (ArrayList) and
>>use in  c:set ex:
>><c:set var="total" value="${list.size}/>
>>The error I am getting is:
>>The "." operator was supplied with an index value of type 
>>"java.lang.String" to be applied to a List or array, but that 
>>value cannot be converted to an integer
>>What is the correct way to get the size value.
>This question comes up a lot, and it probably will continue to do so.
>The JSTL expression language allows you to access JavaBeans properties, not
>arbitrary instance variables or methods.  This will change over time, but
>for now, you'll have to use scriptlets, or perhaps your own custom tags.
It *might* change over time. Currently, the JSTL expression language 
(EL) does not allow willy-nilly method access; however, the EA version 
of JSP2.0 does for the moment. But there's no guarantee that the EL 
(which will be incorporated into JSP2.0) will continue to allow direct 
method access, other than JavaBeans-compliant setter and getter methods.

For now, you can use the JSTL runtime libraries if you need to invoke 
methods other than JavaBeans-compliant setter and getter methods; see my 
other reply in this thread.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message