Chapter 10. Exploring the validation framework
This chapter covers
- Introducing the validation framework
- Wiring your actions for validation
- Building a custom validator
- Adapting the validation framework to your needs
Building on the refinements we saw in the previous chapter, where we added Hibernate-based persistence and Spring resource management to our sample application, this chapter introduces another advanced mechanism of the Struts 2 Framework, the validation framework. We’ve had robust data validation in our Struts 2 Portfolio since chapter 3, where we learned how to implement an action-local form of validation with the Validateable interface’s validate() method. While this method works fine, it has some limitations that eventually become burdensome. We revisit the details of this basic form of validation in the first section of this chapter, and then quickly move on to explore the higher-level validation framework that comes with Struts 2.