Joe, Henrique & Robert:
   Thank you for replies, they all works :)

yours,
lei   

On Mon, May 24, 2004 at 03:38:54PM -0500, Joe Germuska wrote:
> At 1:44 PM +0800 5/22/04, Ding Lei wrote:
> >Hello all,
> >     There is an array(dsmccList) obtained by a self-defined tag, 
> >and I wanna to send the length of the array
> >     as an hidden property, as following:
> >     <iPanel:appListData id='dsmccList'/>
> >     <c:set var="dataCount" value="${dsmccList.length}"/>
> >
> >     But this causes exception:
> >javax.servlet.jsp.el.ELException: 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.
> 
> In JSTL 1.1 (JSP 2.0), you can use the 'length' function:
> http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fn/length.fn.html
> 
> Short of that, no, there is no convenient way to do what you suggest 
> without writing scriptlets.  The JSTL Expression language expects the 
> value to the right of a "." operator to be a bean property name, and 
> neither arrays nor collections have methods that conform to bean 
> property naming conventions that help you do this.
> 
> Actually, rather than writing scriptlets, I usually define a second 
> request-scoped variable that holds the length, or wrap the list in a 
> bean of my own that translates between "getLength()" and array.length 
> or collection.size()
> 
> Maybe you can adjust your custom tag to define two variables, the 
> list and another with the length of the list.
> 
> Joe
> 
> -- 
> Joe Germuska            
> [EMAIL PROTECTED]  
> http://blog.germuska.com    
>       "Imagine if every Thursday your shoes exploded if you tied them 
> the usual way.  This happens to us all the time with computers, and 
> nobody thinks of complaining."
>             -- Jef Raskin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
Yours,

   <<<:::::   D i n g    L e i   ::::::>>
 ||                                      ||
 || Ext: 8106                            ||
 || Email: <dinglei [A] ipanel [O] cn>   ||
 || Dept. Of Technology/Engineering      ||
 || Embedded Information Services Inc.   ||
 ||                                      ||
<((((((    =====================     )))))>>>
        
A child of five could understand this!  Fetch me a child of five.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to