I could be mistaken, but I think what you want to look at is BeanUtils.copyProperties.

Erik


tarek.nabil wrote:

Hi everyone,

I have some insert and update actions where I copy the data the user
entered from the ActionForm to a DTO object which I send as a parameter
to my business method.

Since I can not conform the validity of the entered data before
validation, all the attributes in my ActionForm are of type String. My
DTO on the other hand has type safe fields. In my Action class, since I
know validation has been done successfully, I start copying the values
from type String fields to the type safe fields.

Someone once advised me that I don't have to do this manually, and that
I can use the PropertyUtils class from the org.apache.commons.beanutils
package to do this. I just tried that and it failed. I looked at the
documentation and I found several statements that say that type
conversion is not supported. So, the properties either have to be both
Strings or both Integers for example.

Can someone please advise me if constraint is true. Or is there another
way to automate this task?

Any help is appreciated.

Tarek Nabil

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





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



Reply via email to