struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stjepan Brbot" <stjepan.br...@ht.hr>
Subject Converting DTO into formBean and vice versa
Date Wed, 14 Apr 2004 18:16:13 GMT
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 "dd.mm.yyyy" 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message