Why avoid arrays?  They are more versatile and faster than collections.

Mark

-----Original Message-----
From: Moritz Petersen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 3:14 PM
To: Struts Users Mailing List
Subject: RE: iterate tag usage


Henry,

an array does not extend java.util.Collection. The iterate tag expects a
Collection (which contains a 'iterator()' method). So you have to convert
the array into a collection, either by simply not using arrays in favor of
collections, or by implementing an additional method like:

public Collection getListCollection()
{
   return Arrays.asList(listArray);
}

BTW: I would avoid arrays.

Cheers,
Moritz.

> I have a jsp page with the following code:
>
> <logic:iterate id="regList" name="RegForm" property="listArray">
> <bean:write name="regList" property="listArray"/>
> </logic:iterate>
>
> and in the RegForm.java java bean, we have the following code:
>
>    private String[] listArray;
>
>    public String[] getListArray()
>    {
>       return listArray;
>    }
>
> But when I query the page, I got error:
> javax.servlet.ServletException: No collection found
>
> Why and how to fix?
>
>
>
> ------------------------------------------------------------------
> ---------
> Henry Lu
> MCIT                                            phone: (734) 936-2063
> University of Michigan Medical Center           fax:   (734) 763-4372
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>


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

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

Reply via email to