You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by SImon Freiss <dj...@yahoo.com> on 2005/03/11 15:51:38 UTC

commons.beanutils : Problem with copyProperties and date

Hi,

I have a problem with commons.beanutils and the
LocaleBeanUtils.copyProperties.

I have a ValueObject which contains several attributes
of type Date, Float and String.
I have an ActionForm which contains only attributes of
type String.

Since I have to work with different Locale and
different pattern especially for dates, I decided to
use LocaleBeanUtils.

Before calling the copyProperties method I register
the Converters :

ConvertUtils.register ( new SqlDateLocaleConverter(
Locale.FRANCE,"dd/MM/yyyy") , java.util.Date.class);
ConvertUtils.register ( new StringLocaleConverter(
Locale.FRANCE,"dd/MM/yyyy") , String.class);
LocaleBeanUtils.copyProperties(myForm, myVO);

It works well from Form to VO, but I have a problem
when I try to copy properties from ValueObject to
Form.
I noticed a problem in debug mode in
StringLocaleConverter.

The constructor accepts only one pattern, then the
instance applies the same pattern to Float and Date.
After the execution of the method, all my Float are
converted in something like "dd/MM/yyyy10.2" !!! which
is not really what I was hoping :)

What am I missing ? Is it possible to make it work ?

Any help muchly appreciated



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more. 
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org