this is a mystery.  I gave up trying to use the html bean tags and just
named my input fields w/syntax : FIELDNAME[INDEX] .

let me know if you figure out a cleaner way to do this.  there is a tag
extension that allows you to set a flag indexed=true that names your input
fields accordingly but I can not get it to work in conjunction w/an
iteration from the form bean.

-paul

-----Original Message-----
From: troy hart [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 29, 2001 4:48 PM
To: [EMAIL PROTECTED]
Subject: setting properties on nested collections


I know there has been talk around this subject, if it hasn't been addressed
directly, but I can't seem to find the answer that will work.

My problem:

I have a bean (instance of an ActionForm), lets call it OrderForm. It has an
ArrayList of LineItem objects, and each LineItem contains ArrayList of
Detail objects (the Detail contains shipping information...I allow a
LineItems to be split to multiple shipping addresses...). I can successfully
itterate over and display the contents of this nested structure, but the
problems comes into play when I want to update the contents of the Detail or
LineItem objects. Note: it is no problem to update the simple String
properties of the OrderForm itself.

I simple don't know how to name the <input> properties such that the
BeanUtils class can set the values for me... Below is my approach (all
layout details left off and otherwise simplified...):

...
Some Order Property: <html:text name="orderForm"
property="someOrderProperty" size="50" />
...
<logic:iterate id="lineItem" name="orderForm" property="lineItems">
    Some Line Item Property: <html:text name="lineItem"
property="someLineItemProperty" size="xxx" />
    ...
    <logic:iterate id="detail" name="lineItem" property="details">
        Some Detail Property: <html:text name="detail"
property="someDetailProperty" size="xxx" />
        ...
    </logic:iterate>
</logic:iterate>
...

The code above renders on the page perfectly, but when I make a change to
one of the detail or lineItem properties they don't make it to the nested
objects... I understand that the names of the text <input> parameters that
are generated with the above code will not give the BeanUtils class a chance
in hell of setting the nested values for me, but I am at a loss for how to
approach this.......

Any ideas??? Or can someone point me to an email that has already answered
this question???

Thanks,

Troy


Reply via email to