Thats the way that I do it if my form is also my vo.
I have:
String getFormattedDate()
{
//code to format the java.util.Date here
return formattedDate;
}
void setFormattedDate(String formattedDate)
{
//code to set the java.util.Date here
}
Hope that helps,
-Tim
-----Original Message-----
From: Matthew Van Horn [mailto:[EMAIL PROTECTED]
Sent: Monday, June 02, 2003 3:31 AM
To: Struts Users Mailing List
Subject: Re: Struts can not accept a date field if it is blank
What I do is make the form field be a string, and then just add another
accessor method like:
java.util.Date getMyFieldAsDate(String format) {
String dateString = this.MyField;
//parse the string to a date and return
}
I don't know if this is 'correct', but it works for me.
-matt
On Monday, June 2, 2003, at 03:49 PM, lcl wrote:
> Is there not any other ways?
> Because I want to use a single class to act as formbean and value
> object :-)
>
> However, thank you very much.
>
> "Chen, Gin" <[EMAIL PROTECTED]>
> :[EMAIL PROTECTED]
> ..
>> Use java.lang.String instead of java.sql.Date in your FormBeans
>> -Tim
>>
>> -----Original Message-----
>> From: lcl [mailto:[EMAIL PROTECTED]
>> Sent: Sunday, June 01, 2003 11:13 PM
>> To: [EMAIL PROTECTED]
>> Subject: Struts can not accept a date field if it is blank
>>
>>
>> Hi all ,
>>
>> In my form, there is a date field which can be null in database. So
>> the
> user
>> can let it to be blank,but struts can not convert it to form bean,
>> error
>> message is :
>> org.apache.commons.beanutils.ConversionException
>>
>> So , How can deal with it?
>> Any advice will be appreciate.
>>
>> lcl
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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]
>
---------------------------------------------------------------------
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]