Roland,

I, too, was struggling with how best to transfer data between form-bean and 
entity (value) objects. Like you I found bean utils copyProperties 
problematic since it didn't do conversions.

Then I discovered Ted Husted's "Struts Catalog" 
(http://husted.com/about/scaffolding/catalog.htm), which has this bit of 
code in it:

BeanUtils.populate(target,BeanUtils.describe(source)) ;

This works better than copyProperties; however it doesn't work with optional 
types, like Date.

Worth a read if nothing else.

mark


>From: "Roland Chan" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: Problem w/ ActionForm Value Object mapper by Andrej Consulting
>Date: Wed, 8 May 2002 12:42:48 -0400
>
>To prevent from doing the tedious task of manually copy properties from
>value object to action forms and vice versa I looked to the the
>ActionForm-Value Object mapper by Andrej Consulting
>(http://www.mycgiserver.com/~andrej/technical/struts/struts.jsp) b/c it
>had the benefit over the bean utils copyProperties method in that it
>could do simple data type conversions.
>
>HOWEVER, I have run into a little bit of a snag and have yet to get a
>response from Andrej.
>Going from Form to VO is fine, however, I am experiencing problems with
>VO to Form. It seems as though Integers are not being converted, and
>there are frequent property copying to the wrong form properties. Has
>anyone experienced this?
>
>Also, what is the best way to do a copy to form if the form already
>exists? In the examples, Andrej uses this convention:
>
>form = VOToFormMapper.map(vo, new ExampleForm());
>
>but in my experience, to get your form correctly populated it has to be
>this:
>
>form = VOToFormMapper.map(vo, form);
>
>Any thoughts? I'm also open to alternatives.
>
>Thanks in advance.
>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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

Reply via email to