chain.doFilter(req,res); We used this in a servlet program. I want to know what is the use of the method doFilter() in a servlet? Also what is
chain.doFilter(req,res);
doFilter()
Filters are there to complement Servlets. For the usage, you should read this, The Essentials of Filters. Filters are implemented using Chain of Responsibility GoF pattern.