Ok, the thing I don't understand now is how to setup the
AddNewPhoneNumber jsp so that is uses the lazy list to create a new
PhoneNumber instance bean.

I'm trying to use the nested taglib, but I don't really understand how
to set the top level object to be a new instance out of the list.

I've tried something like this:

<nested:nest property="phoneNumbers">
  <nested:text property="countryCode" />
  <nested:text property="areadCode" />
  <nested:text property="number" />
  <nested:text property="description" />
</nested:nest>

The thing I can't figure out is how you set the top-level object to be a
new instance of the PhoneNumber bean (which should be created from the
lazy list).  I tried using <nested:nest property="phoneNumbers">, but
that gives me an error stating "No getter for property
phoneNumbers.countryCode of bean customerForm".  I figure that is
because the <nested:nest> sets the top-level object to be the List, and
doesn't actually attempt to get an item out of the list (which would
cause the lazy list factory to create a new PhoneNumber instance).  

How is this supposed to work?  Am I on the right track at all?  Anyone
have a link to an example like what I'm trying to do?  

Thanks.

Nate


On Mon, 2003-09-08 at 11:41, Robert Taylor wrote:
> Yep. You could create the new lazy list in the form reset().
> 
> robert
> 
> > -----Original Message-----
> > From: Nate Drake [mailto:[EMAIL PROTECTED]
> > Sent: Monday, September 08, 2003 9:29 AM
> > To: Struts Users Mailing List
> > Subject: RE: Create new nested bean instance
> >
> >
> > Robert,
> >
> > Thanks for the links.  I already read the Indexed Property FAQ (and I
> > just re-read it again), but I didn't really see anything in it that
> > relates to my problem.
> >
> > The lazyList stuff looks more promising.  I have a question about it,
> > though. Where do I create the new LazyList?  In the ActionForms reset()
> > method?
> >
> > Thanks again.
> >
> > Nate
> >
> > On Mon, 2003-09-08 at 06:18, Robert Taylor wrote:
> > > Nate, you may want to look into indexed properties:
> > > http://jakarta.apache.org/struts/faqs/indexedprops.html
> > >
> > > and ListUtils.lazyList():
> > >
> > http://jakarta.apache.org/commons/collections/api/org/apache/commo
> > ns/collect
> > > ions/ListUtils.html
> > >
> > > robert
> > >
> > > > -----Original Message-----
> > > > From: Nate Drake [mailto:[EMAIL PROTECTED]
> > > > Sent: Sunday, September 07, 2003 9:32 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Create new nested bean instance
> > > >
> > > >
> > > > Hi,
> > > >
> > > > What is the "proper" Struts way to implement create/update
> > pages in the
> > > > following scenario.
> > > >
> > > > You've got a Customer Form bean with the following properties:
> > > >
> > > > - First Name
> > > > - Last Name
> > > > - List of PhoneNumber Beans
> > > >
> > > > A PhoneNumber bean with these properties:
> > > >
> > > > - Country Code
> > > > - Area Code
> > > > - Number
> > > > - Description
> > > >
> > > >
> > > > I'd like it to be set up like this:
> > > >
> > > > CreateCustomer.jsp has text fields for first and last name, and it
> > > > displays the list of added phone numbers.  It also has an
> > "Add New Phone
> > > > Number" link.  This link takes you to AddPhoneNumber.jsp.
> > This page has
> > > > fields for all the phone number properties, and an "Add" button.  When
> > > > you press the "Add" button it returns you to the CreateCustomer.jsp.
> > > > The list of phone numbers on this page will reflect the newly added
> > > > phone number.
> > > >
> > > > The part of this I'm having trouble figuring out is how the List of
> > > > phone number beans gets updated.  Is there a way to tell
> > Struts to add a
> > > > new PhoneNumberBean to CustomerBean's list of phone numbers?  Or do I
> > > > have to do it myself in an Action?
> > > >
> > > > I haven't been able to find any examples like this with nested beans.
> > > > All the nested examples I find just show you how to display nested
> > > > data.  I need to create new nested data and add it to the parent.
> > > >
> > > > Any help would be greatly appreciated.
> > > >
> > > > Thanks,
> > > >
> > > > Nate
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to