Spring validator default message codes not resolving
Posted
by Derek Clarkson
on Stack Overflow
See other posts from Stack Overflow
or by Derek Clarkson
Published on 2010-05-12T01:42:59Z
Indexed on
2010/05/12
1:44 UTC
Read the original article
Hit count: 418
Hi all,
I have a custom spring validator which has the following default message:
public @interface FieldMatch {
String message() default "au.com.xxx.website.FieldMatchValidation";
...
The problem I'm having is that the message code is not being resolved and <form:error...> is simply displaying the code rather than the message (Which is in a properties file which is being used by a ResourceBundleMessageSource).
I've also tried this as
String message() default "{au.com.xxx.website.FieldMatchValidation}";
Which causes the message source to crash with an exception indicating that it thinks that the "{}" brackets should contain a number because it thinks it's a parameter place holder.
I think that the issue is that the message code is not being seen as a message code and therefore not resolved, but I cannot figure out why.
Any suggestions?
© Stack Overflow or respective owner