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



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.


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]

Reply via email to