Thats the approach I prefer too - whenever possible.
This way you simply delegate all the get/set calls
in the form class to the get/set of the domain object
(which is member of the form class).
So far this has worked fine for me...
also it avoids having to copy properties using
BeanUtils/PropertyUtils between form and domain
objects.
~ amol
-----Original Message-----
From: Mike Helmick [mailto:helmick@xxxxxxxxx]
Sent: Wednesday, March 23, 2005 9:40 PM
To: josh marotti
Cc: users@xxxxxxxxxx
Subject: Re: [cinjug-users] Struts FormBean <--> Domain Best Practice?
personally ---
I always just include my domain objects (usually hibernate POJOs) as members
of my form bean
no conversion needed :)
<plug>this pattern works better with tapestry</plug>
----------------------------------------------------------------------------
------------------
Michael T Helmick, M.S. 2004 NKU, B.S. 2000 XU
Ph.D. Student - University of Cincinnati, College of Engineering
Web: http://mikehelmick.com/
----------------------------------------------------------------------------
------------------
"we can sleep when we're dead."
On Mar 23, 2005, at 7:46 PM, josh marotti wrote:
I have been involved in the development of several struts
applications. The one thing I have noticed is that everyone has a
different way of converting formbeans to domain (or value) objects and
back. I've seen a conversion manager that lists all the converts as
static methods, a semi-factory pattern, having a formbean having a
'toDomain()' method and the domain having a 'toFormBean()' method,
etc...
The question is, has anyone created a best practice to doing these
conversions? Is it just a matter of personal preference? Is it
dependent on the project?
Thanks,
Josh
---------
You may unsubscribe from this mailing list
by sending a blank email addressed to:
users-unsubscribe@xxxxxxxxxx
--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx
|