internally BeanUtils uses ConvertUtils to convert from Strings to objects. You can deregister the default converters

http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/ConvertUtils.html

The default converters are initialised as follows with 0 for most numeric defaults. if you construct and register converters with no default value, null will be returned for "" or when an error occurs

        converters.clear();
        converters.put(BigDecimal.class, new BigDecimalConverter());
        converters.put(BigInteger.class, new BigIntegerConverter());
        converters.put(Boolean.TYPE, new BooleanConverter(defaultBoolean));
        converters.put(Boolean.class,  new BooleanConverter(defaultBoolean));
        converters.put(booleanArray.getClass(),
                       new BooleanArrayConverter(booleanArray));
        converters.put(Byte.TYPE, new ByteConverter(defaultByte));
        converters.put(Byte.class, new ByteConverter(defaultByte));
        converters.put(byteArray.getClass(),
                       new ByteArrayConverter(byteArray));
        converters.put(Character.TYPE,
                       new CharacterConverter(defaultCharacter));
        converters.put(Character.class,
                       new CharacterConverter(defaultCharacter));
        converters.put(charArray.getClass(),
                       new CharacterArrayConverter(charArray));
        converters.put(Class.class, new ClassConverter());
        converters.put(Double.TYPE, new DoubleConverter(defaultDouble));
        converters.put(Double.class, new DoubleConverter(defaultDouble));
        converters.put(doubleArray.getClass(),
                       new DoubleArrayConverter(doubleArray));
        converters.put(Float.TYPE, new FloatConverter(defaultFloat));
        converters.put(Float.class, new FloatConverter(defaultFloat));
        converters.put(floatArray.getClass(),
                       new FloatArrayConverter(floatArray));
        converters.put(Integer.TYPE, new IntegerConverter(defaultInteger));
        converters.put(Integer.class, new IntegerConverter(defaultInteger));
        converters.put(intArray.getClass(),
                       new IntegerArrayConverter(intArray));
        converters.put(Long.TYPE, new LongConverter(defaultLong));
        converters.put(Long.class, new LongConverter(defaultLong));
        converters.put(longArray.getClass(),
                       new LongArrayConverter(longArray));
        converters.put(Short.TYPE, new ShortConverter(defaultShort));
        converters.put(Short.class, new ShortConverter(defaultShort));
        converters.put(shortArray.getClass(),
                       new ShortArrayConverter(shortArray));
        converters.put(String.class, new StringConverter());
        converters.put(stringArray.getClass(),
                       new StringArrayConverter(stringArray));
        converters.put(Date.class, new SqlDateConverter());
        converters.put(Time.class, new SqlTimeConverter());
        converters.put(Timestamp.class, new SqlTimestampConverter());


Larry Meadors wrote:


Yeah, that is the joy of bean-utils.  It is best to leave it a stringon
the form and convert it yourself.


[EMAIL PROTECTED] 02/16/04 7:45 AM >>>

I have a form with a Long property; I used Long instead of long to have the property nullable, but if the (html) form includes such a property, struts sets the corresponding bean property to 0, even if it has no value (value=""); what I'd like is struts to leave the property at null!! It also behaves so if the (html) property has non numeric value!! Any help is VERY appreciated

Renato

____________________________________
Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_____________________________________



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





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



Reply via email to