过滤器的建立

过滤器的基本结构:

package....;

import....;

public classFilter implements Filter{//这里是给出Filter的一个实现类Filter1

  public void destroy(){

    //添加代码

  }

public void doFilter(ServletRequest request,ServletResponse response,

  FilterChain filterChain)throws IOException,ServletException{

  //添加代码

}

public void init(FilterConfig filterConfig)throws ServletException{

  //添加代码

}

}

原文地址:https://www.cnblogs.com/lls1350767625/p/7789110.html