hi Budi

i think that you should be able to solve this by registering a FloatConverter with a null default value. take a look at the java docs for more details but i think that calling

ConvertUtils.register( new FloatConverter(null), Float.class )

when during initialization should work. (if it doesn't then you'll need to look at creating a custom Converter implementation - see the beanutils package documentation.)

- robert

On Friday, April 4, 2003, at 05:48 AM, Budi Rostiarso wrote:

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



Ross.




---------------------------------------------------------------------
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