|
From: <jue...@we...> - 2003-08-20 16:08:20
|
This is indeed a bug. It's caused by the nesting of BeanWrapperImpl, as =
far as I see: A nested BeanWrapperImpl registers the type mismatch for =
*its* property, without nested path. Unfortunately I don't have any more =
time today, so I'll look into this tomorrow morning.
Juergen
-----Original Message-----
From: jp....@ti... [mailto:jp....@ti...]
Sent: Wednesday, August 20, 2003 5:31 PM
To: j=FCrgen h=F6ller [werk3AT]
Cc: springframework-developer
Subject: RE: [Springframework-developer] Tags
Juergen,
I guess I found a bug. My issue seems due to the use of embedded =
objects. The log tell only about the final object name and not the =
entire path.
This is my field Jsp part:
<p>
<spring:bind path=3D"command.search.referral.date">
<span class=3D"error"><c:out =
value=3D"${status.errorMessage}"/></span>
<p class=3D"label"><fmt:message key=3D"champ.date"/></p>
<input type=3D"text" size=3D"12" maxlength=3D"12" =
name=3D"search.referral.date" value=3D"<c:out =
value=3D"${status.value}"/>">
</spring:bind>
</p>
The log for an invalid input is:
2003-08-20 18:24:34,234 INFO [org.sis.sirene.web.CallingoutController] =
hasErrors
2003-08-20 18:24:34,234 INFO [org.sis.sirene.web.CallingoutController] =
Error: command, org.springframework.validation.FieldError, typeMismatch, =
Failed to convert property value of type [java.lang.String] to required =
type [java.util.Date] for property named [date]; nested exception is:=20
java.lang.IllegalArgumentException: Could not parse date: Unparseable =
date: "20.12.00"
The code that produced the log is:
logger.info("hasErrors");
List lerrors =3D errors.getAllErrors();
Iterator it =3D lerrors.iterator();
while(it.hasNext()) {
ObjectError e =3D (ObjectError)it.next();
logger.info("Error: " + e.getObjectName() + ", " + =
e.getClass().getName() + ", " + e.getCode() + ", " + =
e.getDefaultMessage());
}
But still, I suppose the status.value and status.errorMessage in case or =
such an error are bound to 'date' instead of 'search.referral.date'. =
That is why I have nothing returned.
Jean-Pierre
---------- Initial Header -----------
From : j=FCrgen h=F6ller [werk3AT] <jue...@we...>
To : =
<jp....@ti...>,<spr...@li...>
Cc :=20
Date : Wed, 20 Aug 2003 16:58:42 +0200
Subject : RE: [Springframework-developer] Tags
Jean-Pierre,
You should see a "typeMismatch" error in case of such malformed values. =
If you use status.value, you should see the malformed string again. And =
if you define a message for code "typeMismatch" or =
"typeMismatch.{fieldName}" or "typeMismatch.{objectName}.{fieldName}" =
(see FieldError javadoc) in the message source, you should see a proper =
error message too.
I've just tried on my installation, it still works ;-)
Juergen
-----Original Message-----
From: jp....@ti... [mailto:jp....@ti...]
Sent: Wednesday, August 20, 2003 4:40 PM
To: spr...@li...
Subject: [Springframework-developer] Tags
Hi,
I have a basic problem with the form validation. Ok for rejectValue from =
a validator, but how to handle Mismatch errors from the binder itself?=20
Assume using a date field that is malformed by the user. The editor will =
not be able to parse the date. Currently I come back to the form page as =
expected. But:
1) The malformed data is lost. The field is empty.
2) The status.errorMessage is void also.
How not loose the initial input and how be able to write an error =
message to the user?
Sorry for a so basic question, but if I cannot find the solution, it =
will be worse for new users.
Jean-Pierre
********** L'ADSL A 20 EUR/MOIS**********
Tiscali propose l'ADSL le moins cher du march=E9 : 20 EUR/mois et le =
modem ADSL offert !=20
Pour profiter de cette offre exceptionnelle, cliquez ici : =
http://register.tiscali.fr/adsl/
Offre soumise =E0 conditions.
-------------------------------------------------------
This SF.net email is sponsored by Dice.com.
Did you know that Dice has over 25,000 tech jobs available today? From
careers in IT to Engineering to Tech Sales, Dice has tech jobs from the
best hiring companies. http://www.dice.com/index.epl?rel_code=104
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
********** L'ADSL A 20 EUR/MOIS**********
Tiscali propose l'ADSL le moins cher du march=E9 : 20 EUR/mois et le =
modem ADSL offert !=20
Pour profiter de cette offre exceptionnelle, cliquez ici : =
http://register.tiscali.fr/adsl/
Offre soumise =E0 conditions.
|