struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <>
Subject Re: Converting DTO into formBean and vice versa
Date Sat, 17 Apr 2004 10:00:44 GMT
String -> java.sql.Date is possible with BeanUtils. Write a plugin to
register a Converter with ConvertUtils at app startup.

Actually I believe there are skeleton classes for LocaleBeanUtils to do
what you want, but they haven't been programmed yet. Perhaps you should
check on jakarta about their status. Somebody might have done it.

I had this issue a year ago or so and due to time constraints I dropped
the localized dates and I force my users to enter date format YYYY-MM-DD.


On 04/14/2004 08:16 PM Stjepan Brbot wrote:
> I have DTO (transfering the data from my EJB) with the following
> fields:
> id (java.lang.Integer), name (java.lang.String), birth
> (java.sql.Date)
> also I have a ActionForm bean with the same fields but of String
> types:
> id (java.lang.String), name (java.lang.String), birth
> (java.lang.String)
> my web application implements I18N and deals with German and English
> locales so when user must insert a date in HTML form german user
> inserts the date into String field of ActionForm bean in ""
> format (according to DateFormat (MEDIUM) of "de" locale) and english
> user inserts the date in "mm/dd/yyyy" format (according to DateFormat
> (MEDIUM) of "en" locale).
> To transfer all data fields from FORM into DTO where I do not have
> date field I can use:
> BeanUtils.copyProperties(myDto,myActionForm)
> Now I'd like to have the similar functionlity where I will be able to
> have java.sql.Date field in my DTO object providing BeanUtils with
> particular DateFormat of current Locale. Is there anything like that?
> E.g. LocaleBeanUtils(myDto,myActionForm,dateFormat)?
> Stjepan Brbot
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: For
> additional commands, e-mail:

struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message