struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Kastner <kast...@galt.de>
Subject Re: date validation
Date Mon, 26 Apr 2004 14:31:29 GMT
Hello Riyad,

thanks for your reply. I've tried it - it still throws the same 
exception. As far as I understand the documentation, if the entered 
field data is not recognized as a date, an errormessage should a appear 
in the messages section. But there shouldn't appear an exeption.

Michael Kastner

Riyad Kalla schrieb:
> Just a shot in the dark until someone that knows replies...
> 
> The date.valueOf method requires the format "yyyy-mm-dd", but you are 
> trying to insert "dd.MM.yyyy", maybe try and change your format (jsut 
> for testing sake) and see if its able to convert it without an exception.
> 
> Michael Kastner wrote:
> 
>> Hello,
>>
>> maybe someone can help me. I am trying to use DynaValidatorForm to 
>> enter (amongst other fields) a date field.
>>
>> So, my form bean definition contains this property setting:
>>
>> <form-property name="paymentDue" type="java.util.Date" />
>>
>> In my validation defintion, I use
>>
>> <field
>>     property="paymentDue"
>>     depends="required,date">
>>     <msg
>>         name="required"
>>         key="invoiceeditform.error.paymentdue.required"/>
>>     <var>
>>         <var-name>datePattern</var-name>
>>         <var-value>dd.MM.yyyy</var-value>
>>     </var>
>> </field>
>>
>> However, when I send the form, this exception is being thrown:
>>
>> org.apache.commons.beanutils.ConversionException: Cannot assign value 
>> of type 'java.lang.String' to property 'paymentDue' of type 
>> java.util.Date'
>> ...
>> ...
>>
>>
>> Can anyone give me a hint, if there's anything wrong with my settings? 
>> I've checked with similar questions in this list and some 
>> documentations. If I am not totally off track the validator should be 
>> able to read date strings and convert them to java.util.Date objects.
>>
>> Any help is very much appreciated.
>>
>>
>> Michael Kastner
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



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


Mime
View raw message