Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 14: Validation with Type Convers... > Validation with Type Conversion and ...

Validation with Type Conversion and Formatting in the Sample Application

In the SpringBlog application, Spring 3’s new type conversion and formatting system will be adopted. For validation, the JSR-303 Bean Validation API will be used, with Hibernate Validator as the underlying validation service provider.

To see how these techniques are adopted, let’s take the major entity class, the AbstractBlogPosting class, which is the base class for both blog posting entries and comments, as an example. The class stores the common properties such as the subject, body, and post date, among others.

The main validation and formatting rules of the properties within the AbstractBlogPosting entity class are as follows:

  • The subject field is mandatory, and the number of characters should be between 10 and 50.

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint