struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Christopher <tim.christop...@gmail.com>
Subject Re: AW: Struts Approach
Date Sat, 26 Feb 2005 16:26:44 GMT
> I put a nested Customer object in my action form, and deal with type
> conversions from the web layer there (i.e., dates, numbers, etc) so
> that by the time my action gets involved, it can get the customer from
> the form and pass it to the service layer without worrying too much
> about that stuff. 

Following feedback the code within my Action is roughly the equivilent
of the code below:

CustomerServiceImp customerService = CustomerServiceImp.getInstance();
customerForm customerForm = (CustomerForm) form;
Customer customer = new Customer();
BeanUtils.copyProperties(customer, customerForm);
customerService.insertCustomer(customer);

As far as I'm aware the copyProperties method in BeanUtils deals with
all conversions between the variables (all String) in the
customerForm, and the correctly typed variables within Customer (int,
double, String, date etc - though at the moment it only contains int's
and String's).

I'd like to be able to copy each property off the form indivudally and
do the conversion myself, which I think is what you're doing (quoted
text) - but I'm not sure how to go about doing this. :-(

I'm also a little concerned that my domain object (Customer.java) is
also my DTO - is this good practice?

Thanks for all your help so far,

Tim Christopher

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message