You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by yitzle <yi...@users.sourceforge.net> on 2007/07/12 18:47:29 UTC

[S2] JSP/OGNL - displaying iterator length

I got an iterator that works fine and does what I want it to:

<s:iterator value="iterator">
...
</s:iterator>

A few lines above, I try to print the iterator size:
Total: <s:property value="appRegistries.length"/>

Doesn't display anything.

The OGNL Guide says it supports .length for arrays.
Does is not support iterators? Especially since the iterator is simple
an array container?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] JSP/OGNL - displaying iterator length

Posted by Musachy Barroso <mu...@gmail.com>.
The iterator class doesn't have a length property:

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Iterator.html

you are going to have to get the size from the collection itself.

musachy

On 7/12/07, yitzle <yi...@users.sourceforge.net> wrote:
>
> I got an iterator that works fine and does what I want it to:
>
> <s:iterator value="iterator">
> ...
> </s:iterator>
>
> A few lines above, I try to print the iterator size:
> Total: <s:property value="appRegistries.length"/>
>
> Doesn't display anything.
>
> The OGNL Guide says it supports .length for arrays.
> Does is not support iterators? Especially since the iterator is simple
> an array container?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd