Spring MVC Bean Validation --Data Type Validation
Spring MVC Bean Validation --Data Type Validation public class User { @NotNull(message="Age is Required") @Min(value = 18, message = "Age must be greater than or equal to 18") @Max(value = 150, message = "Age must be less than or equal to 150") private Integer age; } If the User enters "String Value" in age, I want to validate them and should provide error message "Age is Invalid". @OnlyNumber(message = "Age is Invalid") //Like This Which Annotation helps in validating this kind of Type Validation, Similarly if the use enters different type format instead of Date. How do we handle them and provide custom error message. you can create your own @OnlyNumber – Pravin Mar 24 '15 at 15:25 @OnlyNumber 1 Answer 1 ...