You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Sgarlata Matt <sg...@bah.com> on 2003/07/22 18:40:33 UTC

Length of collection using EL?

Does anyone know how to get the length of a collection using the EL?  I am trying to do one of the tests below.  Note that "children" is a List.

<c:if test="${component.parentDao.children.length > 1}">
<!-- stuff here -->
</c:if>

or 

<c:if test="${component.parentDao.children.size > 1}">
<!-- stuff here -->
</c:if>

And get this error:

javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${component.parentDao.children.length > 1}": 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. 

Thanks!

Matt