> -----Original Message-----
> From: Rea, Ron [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 27, 2002 12:05 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Iterate tag question
> 
> 
> I originally had it as an arraylist of these properties, but using an
> ArrayList in the Iterate tag prevents me from being able to edit the

First, how would using an ArrayList prevent you from doing any edits you could do with 
an array?  Edit within the action, right?

Second, in your snippet, you are using html:text, which expects a single Object, but 
your getter is returning a String[].  Not what you want to do.  If you really want to 
use an array here, make it an array of a tuple object (even with an ArrayList, this is 
the way to do it)...one that has getCode() and getDesc() methods.  Then you iterate 
through these objects, outputting your code and description.  Don't use two string 
arrays or two ArrayLists.

peace,
Joe


> individual table row data, then hit one submit button at the end.  Any
> changes are lost.  
> 
> I tried following Husted's instructions on how to do this, 
> found at this
> link: http://www.husted.com/struts/tips/006.html, but the 
> instructions are
> not complete enough and I cannot get the iterate tag to work.  
> 
> 
> 
> -----Original Message-----
> From: John Owen [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, September 27, 2002 12:03 PM
> To: Struts Users Mailing List
> Subject: Re: Iterate tag question
> 
> String[] is just an array of String. It has no iterator. You need a
> Collection, List or Enumeration.
> 
> ----- Original Message -----
> From: "Rea, Ron" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, September 27, 2002 1:35 PM
> Subject: Iterate tag question
> 
> 
> > I am trying to iterate through several array fields on my 
> Form within the
> > JSP, display the properties as a table on the page.  Using 
> arrays should
> > allow me to update the table data, however I cannot seem to get the
> iterate
> > tag to work.  The following is an example of what I'm 
> doing.  Any ideas on
> > how this iterate tag should look - I'm just trying to go through the
> array,
> > held in the ActionForm,  and display each occurance as a 
> row in the JSP.
> >
> > ResponseProcessForm:
> >
> >             public void setMsgCode(String[] msgCode) {
> >                         this.msgCode = msgCode;
> >             }
> >
> >             public String[] getMsgCode() {
> >                         return msgCode;
> >             }
> >
> >             public void setMsgDesc(String[] msgDesc) {
> >                         this.msgDesc = msgDesc;
> >             }
> >
> >             public String[] getMsgDesc() {
> >                         return msgDesc;
> >             }
> >
> > section of JSP:
> >
> >             <logic:iterate id="grid"
> >                          name="responseProcessForm"
> > property="msgCode">
> >                         <td> <bean:write name="grid" 
> property="msgCode"
> > filter="true"/> &nbsp;</td>
> >                         <td><html:text property="msgDesc" size="6"
> > maxlength="6" />&nbsp;</td>
> >             </logic:iterate>
> >
> > Using this code gives me this error: 
> javax.servlet.ServletException: No
> > getter method for property msgCode of bean grid
> >
> > Thanks!
> >
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 

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

Reply via email to