Spring MVC Custom Validation
Spring MVC Custom Validation - FAQ: Is it possible to integrate multiple validation string in one annotation? Answer: Yes, you can do this. In your validation, you will make use of an array of strings. Here's an overview of the steps. 1. Update CourseCode.java to use an array of strings 2. Update CourseCodeConstraintValidator.java to validate against array of strings 3. Update Customer.java to validate using array of strings --- Detailed Steps 1. Update CourseCode.java to use an array of strings Change the value entry to an array of Strings: // define default course code public String[] value() default {"LUV"}; Note the use of square brackets for the array of Strings. Also, the initialized value uses curley-braces for array data. 2. Update CourseCodeConstraintValidator.java to validate against array of strings Change the field for coursePrefixes to an array private String[] coursePrefixes; Update the isValid(...) method to loop through the course...