Bryce Fischer wrote:
You can register a different converter that BeanUtils uses to copy from a string to a date. Write your own converter, using the date format you need, then use ConvertUtils.register(...) to register it.
That's what I do anyhow.
-----Original Message----- From: Leandro Melo [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 10:21 AM To: struts jakarta Subject: ActionForm data type X BeanUtils -> using Dates
Hi,
i believe that a lot of developers use BeanUtils to
copy the data from ActionForms to the specific DTOs.
I've used this approach, but right now i'm facing a
problem, not a big one.
I've allways been confused about working with dates in
Java. I got a jsp where the user must input a date in
the following format.
Date: dd/mm/yyyy That's how we use dates in Brazil: the day, month and
year.
I'd like to make a validation if the user input the
date in the correct manner in the ActionForm (i'm
using traditional validation and the user input comes
in a String). So, keeping in mind the variou ways of
doing this date validation (even the deprecated ones),
how should a do the date validation???? Which one is
the best way??? I just want to check if the user input
a day with 2 digits, a slash, a month with 2 digits,
a slash and a year with 4 digits.
Also, after that i'd like to copy this form data to my
DTO with BeanUtils. Which type should i use in my DTO for this date??? Thanks,
Leandro.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]