Close
« Tutorial

Spring MVC - Form Validation with External Messages MCQ

0/13
0 ✓
0 ✗

1. What is the main benefit of keeping validation messages in an external properties file?

2. Which annotation correctly uses a message key from an external file?

3. What do the curly braces mean in a constraint message such as "{order.quantity.min}"?

4. What is the default base file name that Jakarta Bean Validation looks for to load custom validation messages?

5. Where should the validation messages properties file be placed in a Maven project so it can be found?

6. Which entry is written in the correct properties file format to define the message for a key?

7. A file is named ValidationMessages_fr.properties. What does the _fr part mean?

8. Which Spring class can be registered as a MessageSource to load messages from properties files by base name?

9. What is a basename when configuring a ResourceBundleMessageSource?

10. Which annotation on a handler method parameter tells Spring MVC to validate the form object?

11. What does the BindingResult object hold in a form handler method?

12. What is the usual thing to do in a handler method when bindingResult.hasErrors() returns true?

13. Which Spring form tag library tag is used to display validation error messages for a field?

14. A field has two constraint annotations and both fail. What is the result?

15. Which entry in a messages file defines the message for this annotation?

@NotEmpty(message = "{customer.email.empty}")
private String email;

16. What happens if a constraint annotation has no message attribute set?

Join