On Mon, 9 Apr 2001, Jim Crossley wrote:

> Two questions, please.
> 
> 1) Why do I have to include the 'name' attribute of <logic:iterate> when
> inside an <html:form> element?  It seems gross to have the same string
> in both the JSP page and the <form-bean> element in struts-config.xml.
> 

The <logic:iterate> tag is a general purpose tool that can iterate over
*any* bean or bean property (whether or not it is inside the form
bean).  It seems to me that having the bean behave so differently
depending on whether or not it is nested inside an <html:form> would be
very confusing.

> 2) I have a bean that has a collection of Phone objects, accessible via
> its getPhones() method.  Shouldn't I be able to return EITHER a Phone[]
> or a java.util.Collection?  The following element works fine when a
> Collection is returned, but I get an error ("No getter method for
> property phones of bean myForm") when a Phone[] is returned.
> 
>     <logic:iterate id="phone" name="myForm" property="phones" >
>     <tr>
>       <td>
>         <bean:write name="phone" property="type" />
>       </td>
>       <td>
>         <html:text name="phone" property="number" />
>       </td>
>     </tr>
>     </logic:iterate>
> 
> Thanks in advance.
> 

Can you post the actual getPhones() method of your form bean in the case
where this fails?

Craig


Reply via email to