Simplest Possible Filter
Introduction
This is the simplest possible servlet filter. I demonstrates how the filter can take action before the target is called and after the target is called.
Steps
- Create SimpleFilter.java
- Create Target.jsp
- Declare filter in deployment descriptor
- Map SimpleFilter to Target.jsp in deployment descriptor
Final Code
Source: Target.jsp
Source: smartsoft/tutorial/filters/SimpleFilter.java
Source: /WEB-INF/web.xml
Run It
Target.jsp