commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Budi Rostiarso" <>
Subject BeanUtils.copyProperties and null properties
Date Fri, 04 Apr 2003 04:48:02 GMT
hi to all,
i have a problem which i think is a usual problem, but i cant find the
answer in commons forum, so please help :)

Here we go:
i'm trying to copy properties from Struts' ActionForm to my POJO, and
vice versa.
All properties from ActionForm are String, as suggested, 
and most of the properties in my POJO are Float objects, which
correspond to db column.

My problem is when the user send back the input form, and i use
BeanUtils.copyProperties to copy the content of AF to my POJO, all the
empty property string turns into default object.
For example the from the empty String i get a Float object with value of
0.0, which isn't what i need. 
(i just need null, so i can update the db column with null value, not
0.0 value).

Is this the default behavior of BeanUtils.copyProperties? if its so, how
can i get around this?

If you need further information, i'll be glad to provide.

Thanks in advance


View raw message