Look at
org.apache.commons.beanutils.converters.SqlDateConverter 
or
org.apache.commons.beanutils.converters.DateConverter

to convert the date from String to Dates.

Of course, you will have to validate the String dates in your form's
validate method (e.g. valid date, valid month, valid year).

If its a simple application, you could even use client side Javascript
validation to make sure that a valid date is passed. 

I always add some utility methods to my Data Access Object to transform the
java.sql.Dates to their String value counterparts in the action form so that
I can call
BeanUtils.copyProperties() to populate the ActionForm from the DAO and vice
versa.

HTH

Mahesh

------------------------------------------
Mahesh Joshi
W- 408-543-7214
M- 408-829-8051
[EMAIL PROTECTED]



>>-----Original Message-----
>>From: Manish Singla [mailto:[EMAIL PROTECTED]
>>Sent: Monday, December 08, 2003 3:55 PM
>>To: Struts Users Mailing List
>>Subject: Re: Dealing with dates
>>
>>
>>
>>
>>fredatwork wrote:
>>> I guess this question has been asked many times. Sorry for 
>>raising the
>>> issue once more .
>>>  
>>> but, I would like to ask you about some guidelines how to deal with
>>> dates using Struts.
>>>  
>>> How should be input fields be validated if there are "Date" types ? 
>>>  
>>> Should the ActionForm include a String our a Date type for 
>>date input
>>> fields ?
>>>  
>>ActionForm will be String only. And after that you have to do 
>>validation.
>>
>>> Do you know about some documentation I could help for this purpose ?
>>>  
>>> Fred
>>> 
>>
>>HTH
>>Manish Singla
>>
>>
>>---------------------------------------------------------------------
>>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]

Reply via email to