|
David, Thanks for the response. I need just a little bit more of a nudge in the right direction if you don't mind. I added the array list to my form along with a the corresponding getter and setter methods then placed the array list on the form. I can not get the logic:iterate tag to work unless I place the array list as a separate object in the session. Can you tell me what I am doing wrong? Here is the jsp code. odjb2 is a data bean, summaryOrderDetailList is an ArrayList of odjb2 beans This code works if I separately place summaryOrderDetailList in the session using session.setAttribute("summaryOrderDetailList" , summaryOrderDetailList) but if I set it on the form and stop placing it in the session, the following code stops working. %> <logic:iterate id="odjb2" name="summaryOrderDetailList" > <% //************************************************************************** ************ // Set up alternating row colors //************************************************************************** ************ bgColor = bgColor.equals("silver")? "white" : "silver"; %> <TR bgcolor = "<%= bgColor %>" > <TD width="200"> <bean:write name ="odjb2" property="styleSizeColor" /> </TD> <TD width="200"> <bean:write name ="odjb2" property="styleSizeColorDescription" /> </TD> <TD width="148"> <bean:write name ="odjb2" property="manufacturingOrderNumber" /> </TD> <TD width="148"> <bean:write name ="odjb2" property="rollNumber" /> </TD> <TD width="148"> <bean:write name ="odjb2" property="totalYards" /> </TD> <TD width="200"> <html:text property="odjb2.yardsAffectedString" value="0" size="10" maxlength="10"/> </TD> </TR> </logic:iterate> Thanks for any advice you can give me -hopefully it will not be to start a lawn service as a career :-) -----Original Message----- From: David Morris [mailto:David.Morris@xxxxxxxxxxxxx] Sent: Tuesday, March 04, 2003 12:22 PM To: java400-l@xxxxxxxxxxxx Subject: Re: Imbedding a Form Inside a Sruts logic:iterate tag Stephen, You really don't need to embed form elements in your loop. I haven't used 1.0.2 in quite a while so I can't give you a 1.0.2 example. What you can do is create an array or some form of Collection on your form (or other bean if you have overidden it) along with a setter that takes an index. For example, you might have a class called OrderDetail that has lineNumber, quantity, and amount properties. Both of these would have get/set like getQuantity(). On your form you might have an ArrayList named orderDetails with a getter/setter. In your JSP, you would refer to the properties as property="orderDetails.lineNumber", etc. You would embed these references in html:hidden, html:text tags, etc. I use the nested tags for this, which are somewhat different than the logic:iterate tags, but from what I remember, your iterate tag sets the name for the detail line tags. David Morris >>> Gibson.Stephen@xxxxxxxxxxxxxx 03/04/03 07:15 AM >>> Hello All, I am using Struts 1.0.2 to display a table using a logic:iterate over an array list in the placed session scope. This works great until I try to imbed a html:form into the logic:iterate to make each row updateable (I need to allow the user to change a value in the table). I am then attempting to use an update button on each row to trigger reloading the arraylist with the user supplied value. The jsp errors out each time I add a form tag inside the <TD></TD> that is defined within the logic:iterate tag. If I create a table with a fixed number of rows (without a logic:iterate) it works fine. I will not be able to do this as a solution as I am loading the results of an SQL query to the table and I will not know how many rows I will need. Has anyone created a table using the logic:iterate tag with updateable fields? I would appreciate some pointers here on how to proceed . Thanks Stephen Gibson Lees Carpets - IT Department A Division of Burlington Industries 3330 West Friendly Avenue Greensboro, NC 27410 Phone 336.379.2728 gibson.stephen@xxxxxxxxxxxxxx _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.