Cool, didn't know about BeanUtils.

I've got tomcat 4.1.18 and struts 1.1 b2. Do I already have BeanUtils somewhere? I see its in the Jakarta Commons package, should I grab a certain version of it?

Darrel

Eddie Bush wrote:

BeanUtils.populate(dtoObject, formObject);

How is that a big PITA? If the "core" object is actually storing data in the correct types, you'll lose user input when conversions fail. The goal of most folks is to present the user with their exact, incorrect input for correction. That's why the methodology you speak of is suggested.

For object with the same properties (names) that have different types, use BeanUtils. If you find yourself in a situation where you wish to copy objects with the same properties (names) that are of the same types, use PropertyUtils. You can your PITA conversions down to a single line of code.

Darrel Riekhof wrote:

Just getting started with struts, going through the oreilly book. I've
implemented my presentation layer with struts, and now I'm working on
interfacing it with my business layer. The book recommends converting your
form classes to DTO view classes before passing the data to the business
tier to avoid coupling presentation and business layers.

Makes sense, but it is such a royal pain in the a** doing the conversion,
and the form and view classes are so similar. Anyone know of a clever
strategy for dealing with this issue? I was thinking each one could use
some kind of dynamic proxy that forwards the gets and sets to a lower level
object--they both could use this object to store their data. Then the
conversion would just be setting this object in the DTO view class. Think
this is overkill?

Darrel



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

Reply via email to