struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chen, Gin" <Gin.C...@NielsenMedia.com>
Subject RE: Struts can not accept a date field if it is blank
Date Mon, 02 Jun 2003 15:34:13 GMT
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:horn@accesstech.com]
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" <Gin.Chen@NielsenMedia.com>
> :0BC5187E59E2D411A81000508BB09569055FE4F2@nmrusdunsx6.nielsenmedia.com. 
> ..
>> Use java.lang.String instead of java.sql.Date in your FormBeans
>> -Tim
>>
>> -----Original Message-----
>> From: lcl [mailto:lcl@gnireel.com]
>> Sent: Sunday, June 01, 2003 11:13 PM
>> To: struts-user@jakarta.apache.org
>> 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: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message