struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@blueyonder.co.uk>
Subject Re: error no getter method defined while inside logic:iterate
Date Wed, 25 Feb 2004 13:28:37 GMT
I just noticed something else wrong...your index value is 0 for all three
RawRecords - so you are initializing raw[0] three times and not raw[1]  or
raw[2]

public DateForm() {
  raw = new RawRecord[3];
  raw[0] = new RawRecord("","","","");
  raw[0] = new RawRecord("","","","");
  raw[0] = new RawRecord("","","","");


----- Original Message ----- 
From: <rinkeh@home.nl>
To: <niall.pemberton@blueyonder.co.uk>
Cc: <struts-user@jakarta.apache.org>
Sent: Wednesday, February 25, 2004 1:11 PM
Subject: Re: error no getter method defined while inside logic:iterate


> Hi Niall, List
>
> thanks for you answer. I tried out you suggestion (literary and in
> several variations), but it does not help: still the same error.
>
> no getter defined.
>
> If you have any other suggestions, I'd be happy.
>
> Otherwise I will just try a workaround which is not such a nice
> sollution, but it will work I guess: just put everything, all different
> fields, in one long array, in stead of working with the
> array[0].fieldname option.
>
> rinke
>
>
> On 25 Feb 2004, at 10:00, Niall Pemberton wrote:
>
> > Inside the <logic:iterate> the beans returned by your getRaw() method
> > should be exposed with the name you specify in the iterate's 'id'
> > attribute. So something along the lines of.....
> >
> >  <logic:iterate name="dateForm" property="raw" id="foo"
> >                indexId="ctr" >
> >   <tr>
> >      <td><bean:write name="ctr" /></td>
> >      <td><html:text name="foo"
> >                       property="time" /></td>
> >   </tr>
> >  </logic:iterate>
> >
> > Niall
> >
> > ----- Original Message ----- 
> > From: <rinkeh@home.nl>
> > To: <struts-user@jakarta.apache.org>
> > Sent: Tuesday, February 24, 2004 12:11 PM
> > Subject: error no getter method defined while inside logic:iterate
> >
> >
> > > Hi list,
> > >
> > >
> > > I am having a form which contains a single property, an array with
> > > "RawRecord", a simple java bean which simply contains 4 strings,
> > > including getters, setters and a constructor.
> > >
> > >
> > > In my jsp, it works fine when i make a call like this:
> > >
> > >
> > > <html:text name="dateForm" property="rawRecord[1].time" />
> > >
> > >
> > > where dateform is the name of my action form, and rawRecord is
> > > the array in which the RawRecord  beans reside.
> > >
> > >
> > > However, as soon as I put this inside a <<logic:iterate> loop, all
> > > goes wrong: I get the following error:
> > >
> > >
> > > No getter for property time of bean
> > > org.apache.struts.taglib.html.BEAN
> > >
> > >
> > > which is a lie, because there is a getter for my property, otherwise
> > > the thing wouldn't have been working without the logic:iterate tag.
> > >
> > >
> > > The jsp looks like this:
> > >
> > >
> > > <logic:iterate name="dateForm" property="raw" id="foo"
> > >
> > > indexId="ctr" >
> > >
> > > <tr>
> > >
> > > <td><%= ctr %></td>
> > >
> > > <td>
> > >
> > > <html:text name="dateForm"
> > >
> > > property="rawRecord[1].time" />
> > >
> > > </td>
> > >
> > > ...
> > >
> > >
> > > The DateForm looks like this
> > >
> > >
> > > public class DateForm extends ActionForm {
> > >
> > > //fields
> > >
> > > private RawRecord raw[];
> > >
> > >
> > > public DateForm() {
> > >
> > > raw = new RawRecord[3];
> > >
> > > raw[0] = new RawRecord("","","","");
> > >
> > > raw[0] = new RawRecord("","","","");
> > >
> > > raw[0] = new RawRecord("","","","");
> > >
> > > }
> > >
> > >
> > > //getters setters
> > >
> > >
> > > public RawRecord getRawRecord(int index) {
> > >
> > > return raw[index];
> > >
> > > }
> > >
> > > public RawRecord[] getRaw {
> > >
> > > return raw;
> > >
> > > }
> > >
> > > public void setRaw(RawRecord[] records) {
> > >
> > > raw = records;
> > >
> > > }
> > >
> > > + some reset stuff
> > >
> > >
> > > The RawRecord bean is really just a class with four strings as
> > > fields, + getters + setters + a constructor
> > >
> > >
> > > I did not include struts-config.xml, because it is correct: the
> > > dateform is normally declared as a form bean, and the action is not
> > > even used yet, as the error takes place before that stage. And
> > > struts-config worked without that logic:iterate tag...
> > >
> > >
> > > SO, how can I get this to work inside the logic:iterate tags?? What
> > > am i doing wrong here??
> > >
> > >
> > > thanks, Rinke
> > >
> > >
> > >
> > > --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For
> > additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
>



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


Mime
View raw message