How to apply filters on servlet in Java using NetBeansIDE
1. Open NetBeansIDE.
2. Create a web project.
3. Create a Servlet (say DemoServlet.java) in source.
4. Create entry for servlet in deployment descriptor (web.xml)
5. Create a Filter (say DemoFilter.java) by implementing javax.servlet.Filter interface.
6. Create entry for DemoFilter in deployment discriptor (web.xml)
7. Override Filter interface methods and write code in it.
8. Run the Project.
9. Finish.