1

I got this problem, that I got from my friend a annotation code that checks if input data is proper VIN number. Annotation works fine, however when number is wrong it should render a default message:

String message() default "{validator.nrVINBad}";

I dont't know where to put this message, I tried my *.properties files but it's not that. Everywhere I look, there's always instructions how to make message from *.properties files, but as I know now, you can't put in those files error messages.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Lukas Novicky
  • 921
  • 1
  • 19
  • 44

1 Answers1

1

This is not part of JSF. This is part of Bean Validation (BV, also known as "JSR303"). Both JSF and BV are part of Java EE. JSF just happens to have builtin recognition and delegation for BV.

To localize BV messages, just follow the instructions in chapter 4.3.1.1 of JSR303 specification. In a nutshell, create a ValidationMessages.properties file in the classpath root (there where your Java source code also is, so that it ultimately ends up in /WEB-INF/classes) with he following content:

validator.nrVINBad = Your message here

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555