Rick Reumann wrote:
You shouldn't want a "default" at all provided by BeanUtils for cases
where it can be null! You are using the anomoly of the way Integer is
working and wanting to propogate that poor solution. null should be
null.. it shouldn't be 0 or some default Date if null is provided.
Yes, this is the strange point. So null value doesn't have the same
semantic for Integer, Double etc. and Date, so I find this a bit
confusing ...this means at least different approach in handling the
incorrect values in forms.
If you want a default Date or some other default than provide that
before going to your form...or if after it submits and you see a null,
then provide the default. You could of course register your own
converter to provide a default for when a Date is null- but I would
NOT do this.
I thought about such variant but I don't find it good as well, but may
be this is the less harmful or let's say less painful.
Actually, in regards to a Date, in case you didn't already realize,
you'll have to provide your own converter anyway if you plan to use
java.util.Date since BeanUtils doesn't provide that by default.. it
only provides conversion for java.sql.Date. If you need help with the
converters I can post some code or search the struts archives for
"java.util.Date converter"
I found this as well, which was other surpise. (that java.sql.Date is
not supported directly).
Other confusing is that if you use ConvertUtils to convert back from
Date to String (so you can show it in the jsp) it doesn't use the format
that is loaded by the converter. This problem again force me to have the
format string at least in 2 places: once in the converter that I
register in ConvertUtils, and once in my formatter that I use to display
the date values. Thus, you are encouraged to use the forms primary as
input forms, not as output (but there is a survey among Struts
developers how they use the forms, and more than 50% use them for input
and output)
IMHO this a "inconsistency" and force us to make a lot of additional
workarounds and tricks...
Regards
Borislav
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]