Paul, there is an "indexed" attribute for the <html:..> tags which means you
don't need the scriptlet. So you could have:

 <logic:iterate name="/WelcomeForm" property="things" id="thing">
 <tr>
 <td>color:<html:text name="thing" property="color" indexed="true"/></td>
 <td>food:<html:text name="thing" property="food" indexed="true"/></td>
 <td>number:<html:text name="thing" property="number" indexed="true"/></td>
 </tr>
 </logic:iterate>

----- Original Message ----- 
From: "Paul Stanton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 05, 2004 1:46 AM
Subject: IndexedPropertyDescriptor has null readMethod/writeMethod


> hi. i am trying use work with an indexed property in struts 1.1.
> i have set up my form bean as follows:
> ----code----
> public class WelcomeForm extends ActionForm
> {
> List things = new ArrayList();
>
> public List getThings()
> {
> return things;
> }
>
> public void setThings(List things)
> {
> this.things = things;
> }
>
> public SampleBean getThings(int i)
> {
> return (SampleBean) things.get(i);
> }
>
> public void setThings(int i, SampleBean thing)
> {
> while (things.size() >= i)
> things.add(new SampleBean());
> things.set(i, thing);
> }
> }
> ----/code----
>
> my form is populated and on the request when it gets to my jsp, which
> has the following lines somewhere in the body
>
> ----code----
> <logic:iterate name="/WelcomeForm" property="things" id="thing"
> indexId="beanIndex"><%
> String colProp = "things[" + beanIndex.intValue() + "].color";
> String foodProp = "things[" + beanIndex.intValue() + "].food";
> String numProp = "things[" + beanIndex.intValue() + "].number";%>
> <tr>
> <td>color:<html:text property="<%= colProp %>"/></td>
> <td>food:<html:text property="<%= foodProp %>"/></td>
> <td>number:<html:text property="<%= numProp %>"/></td></tr>
> </logic:iterate>
> ----/code----
>
> this looks fine to me and i'm sure i've done it before.. anyway, when
> run i get: "javax.servlet.jsp.JspException: No getter method for
> property things of bean /WelcomeForm"
>
> from breakpointing etc i have identified the problem: an
> IndexedPropertyDescriptor is created for the 'things' property, however
> the 'readMethod' and 'writeMethod' fields are null. i would expect the
> IndexedPropertyDescriptor to find my indexed methods and my non-indexed
> methods.. why is this happening?
>
> thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



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

Reply via email to