Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

Overview of this book

Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 7. Validate Your Products with a Validator

The most common expected behavior of any web application is that it should validate user data. Every time a user submits data into our web application, it needs to be validated. This is to prevent security attacks, wrong data, or simple user mistake errors. We don't have control over what users may type when submitting data into our web application. For example, they may type some text instead of a date, they may forget to fill mandatory fields, or suppose we used a length of 12 characters for a field in the database and the user entered data the length of 15 characters, then the data cannot be saved in the database. Similarly, there are lots of ways that a user can feed incorrect data into our web application. If we accept these values as valid, then it will create errors and bugs when we process such inputs. This chapter will explain the basics of setting up validation with Spring MVC.

After finishing this chapter, you will have a clear...