We do things a little differently to avoid code so much duplication
between form bean and value object. There is no data conversion as
a value object is always the vehicle for data delivery.

The form bean holds a data value object(DVO), and every String field of the
DVO 
(no validation of input in setter method) is accessed directly on populate
via an accessor to the DVO, getDvo().
<html:text name="myBean" property="dvo.myTextField"/>
Any field that does require validating input (integers, dates, postalCodes,
more
complex objects) has a data holder object in the form bean, along with
get/set for the holder.
<html:text name="myBean" property="myHolderField"/>
These holder objects all take string input and have a validate method called
within
the form bean validate method.
The form bean's getDvo() method populates the DVO from the holder objects
while setDvo() sets the holder objects from the DVO.

This works very well, and we can add to our data model without doing
anything
other than adding to the CMP mapping and the JSP inputs. [Unless we need to
add
a holder object to the form bean.] 

Result: No translation of beans and value objects, only intermediate help on
those
fields that throw exceptions in their setters or require non-String input.



Toby Steel


-----Original Message-----
From: STEVE WILKINSON [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 24, 2002 10:23 AM
To: [EMAIL PROTECTED]
Subject: Re: Value object doubt !!!


Given the comments from Craig on not using Value Objects as form beans our 
project is taking the following approach.

We are creating a "helper" class to transform our ValueObject (Data Transfer

Object as we call it) into a form bean (Strings, Boolean, and boolean types 
only) and the reverse.>
>
>Radhika Nadkarni wrote:
> >
> > hi,
> > Im having an action Form. Im using Value object for data conversions.
> > Now my problem is i have two scenarios for implementing the same : -
> > 1)  Value object will be separate
> > 2)  Value object will be composed within the Form Bean.
> > Can anyone tell me which is the best strategy out of the two ?
> >
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at 
>http://explorer.msn.com/intl.asp.
> >
> > --
> > To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
>


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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

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

Reply via email to