I couldn't find any utility method to only copy non-null properties from the form bean.
I tried your suggestion to describe() the formbean then filter out the nulls, then populate() the destination formbean. That worked for formbeans which do not have nested indexed formbeans. A describe() of the nested formbean collection puts the toString() representation of the Collection into the Map, thus losing the collection object. So finally, I created a mergeBean(srcBean, destBean) method to copy non-null properties and call a similar mergeBean() on each of the nested formbeans. M> -----Original Message----- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: 29 July 2005 03:59 To: [email protected] Subject: Re: Merging form properties Wendy Smoak wrote: > From: "Dave Newton" <[EMAIL PROTECTED]> > >> if in the getPropertyDescriptors method you checked the values for >> null and only returned those that weren't null would this work? > > > That's what I was thinking... but looking at the BeanInfo interface, you > don't have access to the bean itself, so as Laurie said you would have > to know in advance which properties to expose. Never mind, then. :) > > You should probably ask on commons-user... I bet there's a simple way to > do this. (The next thing that comes to mind is subclassing > BeanUtilsBean and overriding the copyProperty method to make it ignore > properties for which the incoming value is null. Would that work?) For what it's worth, I think I just realized I need to solve the same problem, so I'll try and remember to post here if I come up with a nice solution. If you get anything from commons-user drop me a note ;-) L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

