On 8/2/06, Michael Jouravlev wrote: > On 7/20/06, Hubert Rabago wrote: > > FormDef support nested beans, and nested collections of beans. If you > > had a nested Address object, your form would look like: > > > > > > > > > > In your example Address is nested within ActionForm, right? No. What happens is an ActionForm is nested within an ActionForm. ((DynaBean) form).get("address") will return another DynaBean. What if I > have an object like Person having Address as its member. All > properties are strongly-typed so I do not want to expose them for I/O, > instead I want to have autogenerated ActionForm fields so that I could > redisplay them on error. Say I do not nest Persion inside ActionForm. > Can I still somehow have a string property inside my ActionForm that > corresponds to Person.Address? Can this property be autogenerated? This is how FormDef works. Of course, you'll have to tell FormDef about the address form, but that's very easy:
FormUtils.getFormValues() and setFormValues() takes care of handling the nested objects, instantiating them as needed. As you can imagine, they can go multiple levels, all nesting Stringified versions of your business objects. In one of my sample apps, I have a "companyForm" with an "addressForm" and a collection of "employeeForm" objects, with each employee having its own "addressForm" nested form. Hubert --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org