Posted By:
AlessandroA_Garbagnati
Posted On:
Thursday, September 12, 2002 01:25 AM
Hi,
Fiters can be considered a special type of servlet, but their purpose is different of just allowing chainging through a RequestDispatcher call behind the scene.
A filter is called before and after one (or more) servlet or JSP. The idea behind it was to provide a system that allows developers to access to the request and response object before the start and after the end of the process.
Like Tomcat 3.x interceptors, Filters allow the developers to make changes to the request object or even the response object. For example, you can change the "output" of a servlet/JSP, sending it or to a file or even to both file and client...
RequestDispatcher is only a mechanism to pass the control to another servlet (or JSP, is the same thing), temporary (include) or completely (forward).