Hi,
I get a system exception of typemismatch on a date field of a form:
I can not understand why it doesn't catch the error message from my message source so i can show that error with the <form:errors> tag.Code:org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'inserimentoCommand' on field 'alert.inizio': rejected value [nujikl]; codes [typeMismatch.inserimentoCommand.alert.inizio,typeMismatch.alert.inizio,typeMismatch.inizio,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [inserimentoCommand.alert.inizio,alert.inizio]; arguments []; default message [alert.inizio]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'alert.inizio'; nested exception is java.lang.IllegalArgumentException: Could not parse date: Unparseable date: "nujikl"]
I add all typemismatch error messages in the messages.properties, but that error is still thrown as exception and not by BindingResult object.
How can I solve this? This is my message configuation:
and on that message.properties i have this row:Code:<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename" value="file:${configfile.path}messages" /> <property name="defaultEncoding" value="UTF-8" /> </bean>
I'm sure that the messagesoruce is valid because my validator can add custom errors with some message codes.Code:typeMismatch.java.util.Date=Not valid date for field {0}
Can someone help me?
Thank you.


Reply With Quote