On Mon, 12 Jul 2004 12:22:11 -0400, Erik Weber <[EMAIL PROTECTED]> wrote:

Using BeanUtils.copyProperties(), it's a piece of cake to update your Form bean from the ValueObject properties.

Do you have an example of this, or is there one on your site? I indeed have some properties that are the same between form bean and VO, but some are not (for example my form beans use only Strings, but my VOs use some booleans, ints, etc.)

Sorry was busy so unable to keep up with this thread.

No, the types can all be different. BeanUtils will convert them for you, so your formBean can have all Strings (some would argue it should only be all Strings anyway) and your VO obviously will have different types. To copy the properties from your VO to your form bean it's as simple as:

import org.apache.commons.beanutils.BeanUtils;

BeanUtils.copyProperties(youFormBean, yourVO);

If you are dealing with java.util.Dates you'll have one other thing to do (register a converter for your app) but I can explain that more if you need to go that route.

--
Rick

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



Reply via email to