In addition, as shown in Listing 14-30, the @DateTimeFormat annotation is applied to the postDate,
createdDate, and lastModifiedDate properties. Those annotations belong to Spring 3's type conversion
and formatting system. For postDate, the pattern is defined as ISO.DATE, which stands for the pattern
yyyy-MM-dd. For createdDate and LastModifiedDate, the pattern is defined as ISO.DATE_TIME, which
stands for the pattern yyyy-MM-dd'T'HH:mm:ss.SSSZZ.
Enabling the validation, type conversion, and formatting support for Spring 3 is very easy. In the
sample application, we will use Spring MVC in the presentation layer, namely, in the dispatcher servlet's
WebApplicationContext, so we just need to define <mvc:annotation-driven>, and Spring will do the rest
for us. You'll learn more about this in Chapter 17, when we discuss data validation in developing web
applications.
For more details for the usage of validation, type conversion and formatting in the sample
application, please refer to Chapter 21.
Summary
In this chapter, we covered the Spring 3 type conversion system as well as the field formatter SPI. You
saw how the new type conversion system can be used for arbitrary type conversion, in addition to the
PropertyEditors support.
In addition, we covered validation support in Spring, Spring's Validator interface, and the
recommended JSR-303 Bean Validation support in Spring 3.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home