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

Custom validation with JSR-303 / bean validation


In the previous Time for action section, we learned how to use standard JSR-303 bean validation annotations to validate the fields of our domain object. This works great for simple validations, but sometimes, we need to validate some custom rules that aren't available in standard annotations. For example, what if we need to validate that the newly added product ID is not the same as any of the existing product IDs? To accomplish such kinds of validations, we can use custom validation annotations.