Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are several possible reasons why BindingResult.rejectValue may be unable to locate the value from ValidationMessages.properties:

  1. Incorrect property key name: Make sure that the property key name in ValidationMessages.properties matches the field name in your model object.

  2. Missing ValidationMessages.properties file: Ensure that the ValidationMessages.properties file is present in the correct location and contains the correct property key names.

  3. The property file is not loaded: Check if the ValidationMessages.properties file is loaded correctly by the application. In some cases, you may need to explicitly configure and load the property file.

  4. Property file encoding issue: Ensure that the property file is encoded correctly to avoid character encoding issues.

  5. Mismatch between locale and property file: Check that the locale of the ValidationMessages.properties file matches the locale of the user's session. If the two are different, the appropriate message may not be displayed.

By addressing any of these possible issues, BindingResult.rejectValue should be able to locate the value from ValidationMessages.properties.