On 3/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Why does sql.Date work?

Because BeanUtils (at the moment) comes with a registered converter
for jav.sql.Date - but not for java.util.Date. If you want it to
handle String-->java.util.Date you need to register a Converter for
it:

 Converter dateConverter = new MyDateConverter();
 ConvertUtils.register(dateConverter, java.util.Date.class);

Your date converter will need to implement the following interface:

 http://tinyurl.com/2h459j

The section 4.3.1 you refer to below tells you which types are
supported "out of the box".

Niall

And the apache-site states that it's actually possible to use for instance 
java.util.ArrayList.  How do you do that? 
http://struts.apache.org/1.3.5/userGuide/building_controller.html, see section 
4.3.1.

-----Original Message-----
From: Hubert Rabago [mailto:[EMAIL PROTECTED]
Sent: maandag 12 maart 2007 14:06
To: Struts Users Mailing List
Subject: Re: DynaValidatorForm with java.util.Date

The fields of action forms, including DynaValidatorForms are populated
from request parameters, and these values are all in String variables.
 I suggest using a String variable for the dyna validator form field
as well, and just parsing it to get the java.util.Date equivalent when
you use it in your Action classes.

Hubert

On 3/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> And the 3rd mail.  Is it possible to use an object that's different from 
java.lang.* as type for the dynavalidatorform?  I think that's what causing the 
issue here.  If it's not possible, then I'm in deep .... :)
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: maandag 12 maart 2007 10:26
> To: user@struts.apache.org
> Subject: RE: DynaValidatorForm with java.util.Date
>
> Ok, I did some tests and debugging and this is the result:
>
> The errormsg is "Cannot assign value of type 'java.lang.String' to property 
'txtFieldName' of type 'java.util.Date'".
>
> I fill that field with following code: modifyForm.set("txtFieldName",new 
Date());
>
> So the object I'm assigning to that field is a Date-object, but for some 
reason it is converted to a String.
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: maandag 12 maart 2007 9:40
> To: user@struts.apache.org
> Subject: DynaValidatorForm with java.util.Date
>
> Hi
>
> I have a form in which a Date is displayed, using fmt.  It's static text, so 
no user input is required.  The problem is the following.  When the validation of 
that form fails, you return to that form.  Actually, it should return to that 
form, but you're redirected to the error page.
>
> This is the error:
> 2448020 12 03 09:29 [http-8080-Processor24] ERROR 
org.apache.struts.util.RequestUtils  - javax.servlet.ServletException: 
BeanUtils.populate
>
> javax.servlet.ServletException: BeanUtils.populate
>
> The form bean exists of a field, which is hidden, of the type java.util.Date. 
 This is filled by the action, with the correct date.  When I look at the source 
of the page, the date is actually filled in, so that's not the problem.
>
> I assume there's a problem with assigning the java.util.Date-type to a field 
in a DynaValidatorForm, but I'm not sure that's what causing the problem.  There's 
also no validation on that field.
>
> Struts-config:
> <form-bean name="ModifyUserForm" 
type="org.apache.struts.validator.DynaValidatorForm">
>     <form-property name="txtTokenStatus" type="java.util.Date" />
> </form-bean>
>
> Does anybody know how to have a Date-field in your form, in a way you can 
assign it to a textfield and make sure you can also pass it to fmt:formatDate.
>
> Tia
>
> Grtz
>
> Bjorn
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information.  If you have received it in 
error, please notify the sender immediately and delete the original.  Any other 
use of the email by you is prohibited.

---------------------------------------------------------------------
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