You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sundaram Ramasamy <su...@percipia.com> on 2001/04/18 15:14:43 UTC

getting size of a collection

Hi

I have collection like this.
<%    java.util.ArrayList list = new java.util.ArrayList();
list.add("First");
list.add("Second");
list.add("Third");
list.add("Fourth");
list.add("Fifth");
  pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
 %>


Before processing this collection, I want to compare the collection item
grater than 1. how  will I do this.

Can I use like this.

<bean:size name="list" property="size" id="itemsSize" scope="session"/>

Thanks





RE: getting size of a collection

Posted by Sundaram Ramasamy <su...@percipia.com>.
Thanks, it defined like this

<bean:size name="list"  id="itemsSize" scope="page"/>

its working.


-----Original Message-----
From: 	Jean-Noel Ribette [mailto:jean-noel.ribette@improve.fr]
Sent:	Wednesday, April 18, 2001 9:32 AM
To:	struts-user@jakarta.apache.org
Subject:	Re: getting size of  a collection


----- Original Message -----
From: Sundaram Ramasamy <su...@percipia.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, April 18, 2001 3:14 PM
Subject: getting size of a collection


> Hi
>
> I have collection like this.
> <%    java.util.ArrayList list = new java.util.ArrayList();
> list.add("First");
> list.add("Second");
> list.add("Third");
> list.add("Fourth");
> list.add("Fifth");
>   pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
>  %>
>
>
> Before processing this collection, I want to compare the collection item
> grater than 1. how  will I do this.
>
> Can I use like this.
>
> <bean:size name="list" property="size" id="itemsSize" scope="session"/>

Yes you can, but you don't have to put  " property="size'' ". The tag knows
how to get the size of an Array, a
Collection and a Map.

Jean-Noel


Re: getting size of a collection

Posted by Jean-Noel Ribette <je...@improve.fr>.
----- Original Message -----
From: Sundaram Ramasamy <su...@percipia.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, April 18, 2001 3:14 PM
Subject: getting size of a collection


> Hi
>
> I have collection like this.
> <%    java.util.ArrayList list = new java.util.ArrayList();
> list.add("First");
> list.add("Second");
> list.add("Third");
> list.add("Fourth");
> list.add("Fifth");
>   pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
>  %>
>
>
> Before processing this collection, I want to compare the collection item
> grater than 1. how  will I do this.
>
> Can I use like this.
>
> <bean:size name="list" property="size" id="itemsSize" scope="session"/>

Yes you can, but you don't have to put  " property="size'' ". The tag knows how to get the size of an Array, a
Collection and a Map.

Jean-Noel