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]

Reply via email to