Is the change I describe below to way beanutils does primitive wrapper
conversions going to be permanent?

The addition of pluggable converters in ConvertUtils on 3/18 has changed the
way Struts handles empty form fields that map to primitive Wrapper bean
properties. For example, the default IntegerConverter uses a default value
of Integer(0) instead of null.

This is a fairly significant problem because it's not backwards compatible
with Struts 1.0. I often store id number in hidden form fields that map to a
Long or Integer property on the serverside bean. If the hidden field is
empty "" in the html then Struts used to populate the setBlah(Integer)
method with a null, now it passes a zero. That causes me to try an update of
entity 0 instead of adding a new entity, for example. The problem also
occurs with drop downs that use numeric key values. In those cases I
normally submit a "" if nothing is selected and now that becomes 0 in the
form bean.

The current set of converters doesn't even accept null as a legal default
value. If the default is set to null then an exception is thrown when the
conversion fails. In order to fix my applications I used an older
common-beanutils with the 1.1 beta but if this isn't going to be fixed then
I will have to write my own set of converters for Integer and Long.

Let me know if I am confused or confusing.

Thanks, Hal

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

Reply via email to