You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Reumann <ma...@reumann.net> on 2002/11/01 17:44:26 UTC

[NESTING] help appreciated- first collection is populating the others

I'm stumped here what I'm screwing up and would appreciate any help.
I'm playing around using nested tags and for this simple example I
have:

Form Bean
     ArrayList people

     people is populated with Person beans

            Each Person bean has the field
                 String name;
                 ArrayList carList

                           carList is a list of CarBeans
                                   CarBean just has String carName

In my first action that brings me to the form everything gets
prepopulated and the display is fine:

Ex output:
=================================
John
Enter Favorite Cars:
Mustang        Porsche       BMW

Bill
Enter Favorite Cars:
Corvette       Mercedes      Viper

Fred
Enter Favorite Cars:
A              B             C
==================================

The problem is when you change the name of any of the cars, after the
form submits and returns you to this page, it populates all the rows
with whatever the first row has (In this case if you did nothing and
hit submit all 3 rows would look like John's row). I'm sure it's
something simple I'm screwing up and would appreciate any help. Here's
the basics of the jsp nested tag page:

<nested:form  action="myAction">

       <nested:iterate property="people" >

       <nested:write property="name"/><brR>
    
        Enter in Cars:<br>

        <nested:iterate property="carList">

            <nested:text property="carName"/>
    
        </nested:iterate>

        <br><br><br>

    </nested:iterate>

<nested:hidden property="dispatch" value="getResults"/>
<br><br>
<html:submit styleClass="field" value="GET RESULTS"/>

</nested:form>

//reminder:
people = ArrayList in form bean of Person beans
name = String in Person Bean
carList = ArrayList of CarBean beans
carName = String field in CarBean

-- 

Rick
mailto:maillist@reumann.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>