commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Duval <rdg.du...@ibest.com.br>
Subject Re: [beanutils] Problems with BeanUtilsBean : Convert Date to String
Date Mon, 25 Apr 2011 17:14:02 GMT
Yes, I have David,

First of all, due to the nature of the treatment I was supposed to make, I
created a custom DateConverter implementing
org.apache.commons.beanutils.Converter. That being said I just created a new
BeanUtilsBean passing as constructor parameter the ConvertUtilsBean this
way:

    public static BeanUtilsBean createBeanUtils() {
        ConvertUtilsBean convertUtilsBean = new ConvertUtilsBean();
        convertUtilsBean.deregister(Date.class);
        convertUtilsBean.register(new ProdinDateConverter(), Date.class);
        return new BeanUtilsBean(convertUtilsBean);
    }

My ProdinDateConverter uses DateUtils because I can receive the string
representation of a date in a zillion different formats. And of course I
created a new instance and didn't use the global one because the conversion
was supposed to happen only in a signle application tier.

Hope it helps.

2011/4/23 d@v1d v00 <davidvoo@gmail.com>

> Hi there,
>
> Has anyone done this before to populate HTML form data into JavaBeans that
> has Date data type? I really stucked here and hope this mailing list
> (apache
> commons) can help me.
>
> If I can't get help from the source, i have to dtich apache commons
> beansutil project to be used anymore.
>
> Thanks,
>
> David
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message