I have a joda datetime
attribute in my request object and I have used @DateTimeFormat
for the date formatting.
But when I enter an invalid date(say day as 55), it displays the whole message
Failed to convert property value of type java.lang.String to required type org.joda.time.DateTime for property request.myDate; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value "55/12/2014" from type java.lang.String to type org.joda.time.DateTime; nested exception is org.joda.time.IllegalFieldValueException: Cannot parse "55/12/2014": Value 55 for dayOfMonth must be in the range [1,31]
How can I change it to a custom message as the present message is generated by Spring.
In another SO question
Spring mvc Joda Datetime converter fail if invalid date
it is asked to make entry in message.properties.
But I'm not able to understand how will it pick the message from property file as I am not doing any error.rejectValue
type of thing, So how will the message be identified.