On Monday, November 4, 2002, 2:33:26 PM, Sri wrote:


SS> Rick: I think the problem is in how you are initializing your
SS> objects. In particular the problem is where you call the
SS> setCarList() method. Both Persons are getting a reference to the
SS> same list. In other words you have only one car list in memory.
SS> So, when you modify it, you are modifying the car list for both
SS> persons.

SS> Make sense?

    Ahh yes it most certainly does. Thanks! I should have caught that.
    In trying to be quick and dirty for this example I screwed up.

SS> Aside: Try not to initialize your bean in the reset() method. It
SS> gets called each time the form is submitted before Struts sets the
SS> values the user provided. Can you somehow, move that logic to the
SS> Action class?

    Actually I was just doing it all in the reset to figure out where
    I was screwing up. The problem is it appears that I do have to do
    some of this in the reset method since initially I was working on
    this example using check boxes and I realized I have to reset the
    car objects boolean property to false. What's the best way to go
    about this? In other words say you are working on an example where
    you have objects pretty deeply nested and one of the Lists deeply
    nested has objects in it where you need to work with checkboxes
    for the boolean properties. Don't I have to end up creating the
    whole nested hierarchy all over again just to make sure these
    boolean properties are reset to false? What's the best way to
    tackle this situation?

    Thanks so much for the help so far.



-- 

Rick
mailto:maillist@;reumann.net


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

Reply via email to