PDA

View Full Version : Personalization of binding error messages



templth
Aug 26th, 2004, 03:32 AM
Hi,

I want to personalize errors messages that occur during the binding of form fields into beans.
Here is the kind of messages:

Failed to convert property value of type [java.lang.String] to required type [int] for property 'champ2'; nested exception is java.lang.NumberFormatException: For input string: "132f"

Thanks for your help.
Thierry

fmourioux
Aug 26th, 2004, 06:59 AM
Someone tell me few day ago :

<<<
For customize the error message that appears when the conversion is not successful. This is done by adding messages to your messages.properties (or whatever it is named) file like this:

typeMismatch.java.util.Date=The value must be a date in the form 'dd/MM/yyyy'.
>>>

+ d'infos : http://www.springframework.org/docs/api/org/springframework/validation/DefaultMessageCodesResolver.html.

Good luck,

Fabien.

templth
Aug 27th, 2004, 04:41 AM
Hello,

I try it and it works fine :D
Thanks for your help...
Thierry