|
From: =?iso-8859-1?Q?<jp....@ti...> - 2003-08-20 15:43:15
|
Juergen,=0D=0A=0D=0AI 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 no=
t the entire path.=0D=0A=0D=0AThis is my field Jsp part:=0D=0A<p>=0D=0A =
<spring:bind path=3D"command.search.referral.date">=0D=0A <span class=3D=
"error"><c:out value=3D"${status.errorMessage}"/></span>=0D=0A <p class=3D=
"label"><fmt:message key=3D"champ.date"/></p>=0D=0A <input type=3D"text" =
size=3D"12" maxlength=3D"12" name=3D"search.referral.date" value=3D"<c:ou=
t value=3D"${status.value}"/>">=0D=0A </spring:bind>=0D=0A</p>=0D=0A=0D=0A=
The log for an invalid input is:=0D=0A2003-08-20 18:24:34,234 INFO [org.=
sis.sirene.web.CallingoutController] hasErrors=0D=0A2003-08-20 18:24:34,2=
34 INFO [org.sis.sirene.web.CallingoutController] Error: command, org.sp=
ringframework.validation.FieldError, typeMismatch, Failed to convert prop=
erty value of type [java.lang.String] to required type [java.util.Date] f=
or property named [date]; nested exception is: =0D=0A java.lang.IllegalAr=
gumentException: Could not parse date: Unparseable date: "20.12.00"=0D=0A=
=0D=0AThe code that produced the log is:=0D=0Alogger.info("hasErrors");=0D=
=0AList lerrors =3D errors.getAllErrors();=0D=0AIterator it =3D lerrors.i=
terator();=0D=0Awhile(it.hasNext()) {=0D=0A ObjectError e =3D (ObjectErro=
r)it.next();=0D=0A logger.info("Error: " + e.getObjectName() + ", " + e.g=
etClass().getName() + ", " + e.getCode() + ", " + e.getDefaultMessage());=
=0D=0A}=0D=0A=0D=0ABut still, I suppose the status.value and status.error=
Message in case or such an error are bound to 'date' instead of 'search.r=
eferral.date'. That is why I have nothing returned.=0D=0A=0D=0AJean-Pierr=
e=0D=0A=0D=0A=0D=0A---------- Initial Header -----------=0D=0A=0D=0AFrom =
: j=FCrgen h=F6ller [werk3AT] <jue...@we...>=0D=0ATo =
: <jp....@ti...>,<spr...@li...=
forge.net>=0D=0ACc : =0D=0ADate : Wed, 20 Aug 2003 16:58:42=
+0200=0D=0ASubject : RE: [Springframework-developer] Tags=0D=0A=0D=0AJea=
n-Pierre,=0D=0A=0D=0AYou should see a "typeMismatch" error in case of suc=
h malformed values. If you use status.value, you should see the malformed=
string again. And if you define a message for code "typeMismatch" or "ty=
peMismatch.{fieldName}" or "typeMismatch.{objectName}.{fieldName}" (see F=
ieldError javadoc) in the message source, you should see a proper error m=
essage too.=0D=0A=0D=0AI've just tried on my installation, it still works=
;-)=0D=0A=0D=0AJuergen=0D=0A=0D=0A=0D=0A-----Original Message-----=0D=0A=
From: jp....@ti... [mailto:jp....@ti...]=0D=0ASent: Wedne=
sday, August 20, 2003 4:40 PM=0D=0ATo: spr...@li...=
urceforge.net=0D=0ASubject: [Springframework-developer] Tags=0D=0A=0D=0A=0D=
=0AHi,=0D=0AI have a basic problem with the form validation. Ok for rejec=
tValue from a validator, but how to handle Mismatch errors from the binde=
r itself? =0D=0AAssume 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 t=
he form page as expected. But:=0D=0A1) The malformed data is lost. The fi=
eld is empty.=0D=0A2) The status.errorMessage is void also.=0D=0A=0D=0AHo=
w not loose the initial input and how be able to write an error message t=
o the user?=0D=0A=0D=0ASorry for a so basic question, but if I cannot fin=
d the solution, it will be worse for new users.=0D=0A=0D=0AJean-Pierre=0D=
=0A=0D=0A=0D=0A********** L'ADSL A 20 EUR/MOIS**********=0D=0ATiscali pro=
pose l'ADSL le moins cher du march=E9 : 20 EUR/mois et le modem ADSL offe=
rt ! =0D=0APour profiter de cette offre exceptionnelle, cliquez ici : htt=
p://register.tiscali.fr/adsl/=0D=0AOffre soumise =E0 conditions.=0D=0A=0D=
=0A=0D=0A=0D=0A=0D=0A----------------------------------------------------=
---=0D=0AThis SF.net email is sponsored by Dice.com.=0D=0ADid you know th=
at Dice has over 25,000 tech jobs available today? From=0D=0Acareers in I=
T to Engineering to Tech Sales, Dice has tech jobs from the=0D=0Abest hir=
ing companies. http://www.dice.com/index.epl?rel_code=104=0D=0A__________=
_____________________________________=0D=0ASpringframework-developer mail=
ing lis...@li...=0D=0Ahttps:=
//lists.sourceforge.net/lists/listinfo/springframework-developer=0D=0A=0A=
=0A********** L'ADSL A 20 EUR/MOIS**********=0ATiscali propose l'ADSL le =
moins cher du march=E9 : 20 EUR/mois et le modem ADSL offert ! =0APour pr=
ofiter de cette offre exceptionnelle, cliquez ici : http://register.tisca=
li.fr/adsl/=0AOffre soumise =E0 conditions.=0A
|