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?
用
@WebFilter
注解无法保证过滤顺序,或者说Servlet 3.0规范中没有定义。详情可参阅: http://stackoverflow.com/ques...