Download a Sample Chapter
Chapter 6: Validator
This chapter covers installing, configuring and using the Validator plugin
for client-side and server-side form data validation.
Table of Contents
- Part I: The Struts Framework
- Chapter 1: An Introduction to Struts
- Chapter 2: A Sample Struts Application
- Chapter 3: The Model Layer
- Chapter 4: The View Layer
- Chapter 5: The Controller Layer
- Chapter 6: Validator
- Chapter 7: Tiles
- Chapter 8: Declarative Exception Handling
- Chapter 9: Struts Modules
- Chapter 10: Internationalizing Struts Applications
- Part II: The Struts Tag Libraries
- Chapter 11: HTML Tag Library
- Chapter 12: Bean Tag Library
- Chapter 13: Logic Tag Library
- Chapter 14: Nested Tag Library
- Chapter 15: Using JSTL with Struts
- Part III: Struts Configuration Files
- Chapter 16: The Struts Configuration File
- Chapter 17: The Tiles Configuration File
- Chapter 18: The Validator Configuration File
- Part IV: Applying Struts
- Chapter 19: Securing Struts Applications
- Chapter 20: Testing Struts Applications
- Part V: Appendix
- Struts Console Quick Reference
Download Source Code
Download the source code for the listings and applications in each of the chapters here:
Following is a list of errors (and their corrections) in the current (1st) edition of the book.
- All of the code in the book makes use of the deprecated ActionErrors object which will generate compilation issues. Any instance of ActionErrors should be replaced with ActionMessages.
- On page 29 of Chapter 2 the configuration file sample should not include the <forward> definition.
- On page 34 of Chapter 2 the description of the <load-on-startup> tag is incorrect. The <load-on-startup> tag is used to specify the order that servlets are loaded for a given web application, not how many instances of the servlet should be instantiated.
- Many of the Java source code files in Chapters 2, 3, 4, and 5 have a package of com.jamesholmes.struts, but should be com.jamesholmes.minihr in order to work properly.
- On page 82 of Chapter 5 the sentence that says MappingDispatchAction should say LookupDispatchAction.
- On page 102 of Chapter 6 the instructions for enabling client-side validations should mention that you must update your JSP's <html:form> tag to have an onsubmit attribute in order for the client-side validations to work (i.e. <html:form action="/Search" onsubmit="return validateSearchForm(this);">).
- On page 154 of Chapter 8 the package in the Java source code file should be com.jamesholmes.minihr instead of com.jamesholmes.minihr.EmailExceptionHandler.
- On page 167 of Chapter 9 the SwitchAction usage example is incorrect because it specifies the module name in the page parameter value of the link. The example should be <html:link action="/switchMod?prefix=moduleA&page=/main.jsp"> instead of <html:link action="/switchMod?prefix=moduleA&page=/moduleA/main.jsp">.
- Chapter 9 is missing instructions that state that the index.jsp file must be updated to work properly in the modules example. You can find the updated index.jsp file in the downloadable source code from this site.
- In Chapter 13 the greaterEqual, greaterThan, lessEqual and lessThan tag usage examples mention comparing the "User-Agent" HTTP header against values, but should be "Content-Length" instead of "User-Agent".
- On page 394 of Chapter 18 the explanation of the constant tag shows an example <constant> definition with a nested <constant-phone> definition. The nested definition should be <constant-value>, not <constant-phone>.