struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moritz Petersen" <devmaill...@pnpconsult.com>
Subject RE: iterate tag usage
Date Tue, 12 Feb 2002 20:14:08 GMT
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:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>
>


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


Mime
View raw message