Request Validation Filter

Introduction

This filter examines the request and checks for blanks. It uses a parameter naming convention in which the validation rule is encoded in the parameter name. If a required field is left blank an exception is thrown. Else, control is passed to the target.

Final Code

  • Source: Form.html
  • Source: Form.jsp
  • Source: smartsoft/tutorial/filters/ValidationFilter.java
  • Source: /WEB-INF/web.xml
  • Run It

  • Form.html