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]