Thanks Joe!! I'll give this a shot and let you know...
Ron -----Original Message----- From: Joe Barefoot [mailto:[EMAIL PROTECTED]] Sent: Friday, September 27, 2002 1:04 PM To: Struts Users Mailing List Subject: RE: Iterate tag question Okay, now I understand what you meant by "edit". You might be right about needing to use an array in this case, as I have never had to do exactly what you're doing. So, if you want to proceed in this vein, I *think* you should do something like this: <logic:iterate id="grid" name="responseProcessForm" property="msgCode" indexID="index"> <td> <bean:write name='responseProcessForm' property='<%= "msgCode[" + index.intValue() + "]" %>' filter='true'/> </td> <td><html:text name='responseProcessForm' property='<%= "msgDesc[" + index.intValue() + "]" %>' size='6' maxlength="6" /> </td> </logic:iterate> Couple of things to note here: 1. You are only using the iterate tag to get the index value. Your two arrays must be of the same length of course, and it doesn't matter which one you iterate through. 2. You are not using the id attribute of the iterage tag at all, but I *think* it's required, so I left it there. 3. The index is actually a big Integer, hence the intValue() method call. 4. The attributes have single quotes around them for a reason. There are String literals embedded in the JSP expressions in the attributes...usually the double quotes confuse the JSP compiler, so I put single quotes around the attribute value itself. This is valid, but you can't mix usage within a tag (i.e. single and double for attributes) 5. You may want to replace the String literals I have used with prefix/suffix variables created from bean:define tags. That was you can eliminate some of the quotes and it might look cleaner to you. 6. (this is the important one) I've never had to do this, but AFAIK this should work just fine. 7. Hey, let me know if this works. ;) peace, Joe > -----Original Message----- > From: Rea, Ron [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 27, 2002 12:29 PM > To: 'Struts Users Mailing List' > Subject: RE: Iterate tag question > > > If you have a working example of how I could actually modify > properties > presented through an ArrayList, I would be forever grateful > <g> to see that. > I have no problem presenting an ArrayList of properties, but > everything I > have read indicates that you have to nead an edit button on > each row in > order to send changed data back to the Action class. Our > users want a table > of data presented back to them, where they can make changes > to each row, > then hit submit at the end and have the Action class update > the data table > with the edits. Unfortunately, I have not been able to do > this using an > ArrayList, and I think the link to Husted's site indicated > the same, but > maybe I'm wrong. If you have, I'd really like to know how > you did it. > > Thanks! > > -----Original Message----- > From: Joe Barefoot [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 27, 2002 12:15 PM > To: Struts Users Mailing List > Subject: RE: Iterate tag question > > > > > -----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"/> </td> > > > <td><html:text property="msgDesc" size="6" > > > maxlength="6" /> </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]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>