First of all, I know that configuring filters under web. After that, the second filter filters, and finally to the Servlet:
Servlet configuration:
@WebServlet(name = "LoginSvlt", urlPatterns = "/f1/f2/xxx.do")
First layer Filter configuration:
@WebFilter(description = "first filter", urlPatterns = { "/f1/*" })Second Filter configuration :
@WebFilter(description = "Second filter", urlPatterns = { "/f1/f2/*" })Request:
<form action="/../f1/f2/xxx.do" method="post">...</form>But in fact, every time the Servlet is requested, it will enter the second filter first. filter, then enter the first filter, then enter the second filter, and finally reach the Servlet. What is the difference between using annotation configuration and configuring the filter under web.xml?
Using the
@WebFilter
annotation cannot guarantee the filtering order, or it is not defined in the Servlet 3.0 specification.For details, please refer to: http://stackoverflow.com/ques...