You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sashi Ravipati <Ra...@michigan.gov> on 2003/06/10 15:33:21 UTC

Logic:iterate

i have the following code in my .jsp

<TABLE id="mytable">
    <logic:equal property="amount" name="addRateForm" value="1">
          <logic:iterate id="row" name="addRateForm"   property="iterator"
>
         <tr>
           <td><html:text name="row" property="firstName" /></td>
          </tr>
         </logic:iterate>
    </logic:equal>
       <tr>
           <td><html:text  property="firstName" /></td>
          </tr>
</TABLE>

in my action form I have
   private String[] FirstName={};
   private String[] iterator={"",""}; // For testing i initialised to 2
values

public String[] getFirstName(){
    return FirstName;
  }

  public void setFirstName(String[] newName){
    FirstName = newName;
  }

public String[] getIterator() {
    return this.iterator;
}
public void setIterator(String iterator[]) {
    this.iterator = iterator;
}


The above table can have multiple rows. When the page is first loaded one
row is displayed, the user can click on a addrow button to create n-rows.
Once he is done he will click submit, I would like to submit the page and
reload the same page with all the details again in the table (repopulate).


It throws the following error--

Error Message: No getter method for property firstName of bean row  (I have
the get and set methods in my action form)


I am new to struts and I think I am missing some thing. PLS help

Thanks

Re: Logic:iterate

Posted by James Mitchell <jm...@apache.org>.
This is because "row" is defined on the page as a String.  (getIterator()
returns an array of String)

Based on the jsp snippet you've provided, I'm not understanding what you are
trying to do.

Can you explain further?

--
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org


----- Original Message -----
From: "Sashi Ravipati" <Ra...@michigan.gov>
To: <st...@jakarta.apache.org>
Sent: Tuesday, June 10, 2003 9:33 AM
Subject: Logic:iterate


i have the following code in my .jsp

<TABLE id="mytable">
    <logic:equal property="amount" name="addRateForm" value="1">
          <logic:iterate id="row" name="addRateForm"   property="iterator"
>
         <tr>
           <td><html:text name="row" property="firstName" /></td>
          </tr>
         </logic:iterate>
    </logic:equal>
       <tr>
           <td><html:text  property="firstName" /></td>
          </tr>
</TABLE>

in my action form I have
   private String[] FirstName={};
   private String[] iterator={"",""}; // For testing i initialised to 2
values

public String[] getFirstName(){
    return FirstName;
  }

  public void setFirstName(String[] newName){
    FirstName = newName;
  }

public String[] getIterator() {
    return this.iterator;
}
public void setIterator(String iterator[]) {
    this.iterator = iterator;
}


The above table can have multiple rows. When the page is first loaded one
row is displayed, the user can click on a addrow button to create n-rows.
Once he is done he will click submit, I would like to submit the page and
reload the same page with all the details again in the table (repopulate).


It throws the following error--

Error Message: No getter method for property firstName of bean row  (I have
the get and set methods in my action form)


I am new to struts and I think I am missing some thing. PLS help

Thanks



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