Jakarta Beanutils - Conversion rules for null
843841May 27 2004 — edited Jun 9 2004Hi all,
I am using the BeanUtils.copyProperties(target, source) method to copy my Struts ActionForm String-only fields into my Business JavaBean's typed fields (String, Boolean and Integer fields).
The thing I am having trouble understanding is if there is no request variable sent for a particular value, this value is null in the Struts action form - but the copyProperties method uses this null String to populate an Integer field on my business bean as new Integer(0) - and not simply populating this value with null.
This doesn't seem intuitive to me - if the HTML form had no value for a certain field, I expect both ActionForm and Business bean to also have a null value - the the form have the value "0", then I would expect this to get mapped through to new Integer(0) in the back end.
Is there any documentation that explain the default BeanUtils conversion rules, or ways or adjusting these rules programatically ?
I have browsed the jakarta site for a while, but not seem anything of immediate use, and google isn't helping at all !
Many thanks for you help,
Ben