My requirement is really a bit different. I have an expression, which
returns a List, the size of which I would like to display. I.e. I have
${myController.activitiesForResource}, which returns a list.

If I try <c:out
value="${fn:length(${myController.activitiesForResource})}"/> I get an error
saying "EL expressions are not supported". Any ideas?

Thanks,

Marius

-----Original Message-----
From: Christian Taylor [mailto:[EMAIL PROTECTED]
Sent: 02 August 2005 01:08
To: Tag Libraries Users List
Subject: Re: How to print an "int" with a c:out tag?


Hi Marius,

Check out the fn:length() function, this is what you are looking for.
size() is a method and you cannot call methods directly from JSTL (only
getters and setters), but the fn taglib provides a function for length
of Collections and strings. See the JSTL 1.1 documentation for more
information, but basically fn:length() is what you are looking for:

<c:out value="${fn:length(myList)}"/>

Hope this helps.

 -Christian

Marius Botha wrote:

>Hi there,
>
>Just a basic question. I am trying to print out the size() of a List, like
>the tag below.
>
><c:out value="${myList.size}"/>
>
>But I am getting the following error: "An error occurred while evaluating
>custom action attribute "value" with value "${myList.size}": 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. (null)"
>
>Can the c:out tag not print int's or is it that I am calling "size()" which
>does not have a getter/setter method? Please help.
>
>Thanks,
>
>Marius
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


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


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

Reply via email to