Re: Converting DTO into formBean and vice versa

2004-04-17 Thread Adam Hardy
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 -MM-DD.
Adam

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 "dd.mm."
format (according to DateFormat (MEDIUM) of "de" locale) and english
user inserts the date in "mm/dd/" 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: [EMAIL PROTECTED] For
additional commands, e-mail: [EMAIL PROTECTED]



--
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Converting DTO into formBean and vice versa

2004-04-16 Thread Stjepan Brbot
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." format (according to DateFormat (MEDIUM) of "de" 
locale) and english user inserts the date in "mm/dd/" 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]