@WebFilter("/*")
public class File implements Filter {
public void init(FilterConfig filterConfig) throws ServletException {
System.out.println("初始化過濾器");
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
System.out.println("執行過濾器");
// TODO
filterChain.doFilter(servletRequest,servletResponse);(必寫,不寫的話有可能會報錯)
}
public void destroy() {
System.out.println("銷燬過濾器");
}
}