Spring MVC Form Validation Tutorial (With Annotations and ResourceBundle)

In our previous Spring MVC Validation with annotation tutorial we have learnt how to use JSR303 Bean Validation to validate our Spring MVC Forms. There you could see the validation messages are added on the bean constraints itself @NotEmpty(message=“FirstName cannot be empty”) but that is not the way we code in the real world situation. Messages will be added to a property file separately so that we don’t have to restart the server every time when we modify the validation message or when we add a new message. Let’s see how to do validation with ResourceBundle. [Read more…]

Spring MVC Form Validation Tutorial (With Annotations)

In this tutorial we will learn how to validate the Spring MVC application using the Bean Validation ( JSR 303 Bean Validation). We will develop a Spring MVC Form validation constratints for the FirstName,LastName,Emails fields. Once when the user submits the form the server-side validation will be applied and the corresponding Validation messages will be thrown if any.

This requires two important jar files along with other Spring related jars to be added to lib folder

  1. hibernate-validator-4.2.0.Final.jar
  2. validation-api-1.0.0.GA.jar

[Read more…]