I was trying to make a filter to stop users who are not logged in from accessing certain pages.For this i made a filter class with the following doFilter method
doFilter
I believe that you should either invoke sendRedirect OR doFilter. E.g.
if (requiresLogin) response.sendRedirect("/login.jsp"); else chain.doFilter(req,resp);