Mastering Spring 5.0
上QQ阅读APP看书,第一时间看更新

Flow 6 - Adding validation to the previous flow

In the previous flow, we added a form. However, we did not validate the values in the form. While we can write JavaScript to validate the form content, it is always secure to do validation on the server. In this flow, let's add validation to the form that we created earlier on the server side using Spring MVC.

Spring MVC provides great integration with the Bean Validation API. JSR 303 and JSR 349 define specifications for the the Bean Validation API (version 1.0 and 1.1, respectively), and Hibernate Validator is the reference implementation.