其他分享
首页 > 其他分享> > Filter概述和Filter快速入门

Filter概述和Filter快速入门

作者:互联网

Filter:过滤器

package com.ailyt.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter("/*")
public class FilterStudy01 implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("进入");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException {
        System.out.println("FilterStudy01被执行了");
        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {
        System.out.println("销毁了");
    }
}

image

标签:入门,System,Filter,Override,概述,过滤器,public,out
来源: https://www.cnblogs.com/ailhy/p/16597554.html