commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Lamuette" <turbine.lammel...@laposte.net>
Subject [BeanUtils] Registering converters. Help!!
Date Sat, 25 Jan 2003 14:01:10 GMT
BeanUtils v1.6 in Stuts 1.1b3
When trying to resolve the problem of populating form bean or business bean
with date types, I use :
   ConvertUtils.register ( new SqlDateLocaleConverter( Locale.getDefault(),
"dd/MM/yyyy") , java.sql.Date.class);
   ConvertUtils.register ( new StringLocaleConverter(
Locale.getDefault(),"dd/MM/yyyy") , String.class);

eveything works great by using BeansUtil.copyProperties(form,business)
* in my form bean, String type for my date
* in my business bean, java.sql.Date type for my date

But the problems appear when I add another property to my form and my
business bean,
* in my form bean, String type for my integer
* in my business bean, Integer type for my integer

BeanUtils copy in the string property of my form bean : dd/MM/yyyyMYINTEGER
Actually, it uses the same pattern "dd/MM/yyyy" for converting Integer to
String than for converting Date to String.
The problem is obviously there in the management of the different sources of
pattern in the Converters, the pattern is not related to the source type of
the conversion. Am I right ?
Thank you for your support.
Richard.


Mime
View raw message