Chapter 12. The Struts Framework: Validating User Input

Topics in This Chapter

  • Manually validating input fields in an Action or ActionForm
  • Returning to the input page when errors occur
  • Displaying messages with the html:messages tag
  • Using rules in validation.xml to check input fields
  • Adding client-side JavaScript validation

Probably the most tedious and time-consuming part of developing a Web site is validation of the input data. There is no easy way of getting around it—you have to check for missing or poorly formatted input values. Unfortunately, the servlet and JSP APIs provide no mechanism for easily validating input data!

To the rescue come the Struts Validation framework. The framework is incredibly flexible and easy to use, supporting ...

Get Core Servlets and JavaServer Pages, Volume 2: Advanced Technologies, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.