创建并配置过滤器:

Servlet过滤器:

核心对象:   javax.servlet.Filter

相关对象:   javax.servlet.FilterConfig

                  javax.servlet.FilterChain

实现过滤器:

public class Myfilter implements Filter{

                               重写init(),doFilter(),destory()方法  ·····

                public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain){

                }

}

配置过滤器:

<filter>

   <filter-name>Myfilter</filter-name>

   <filter-class>包名.类名</filter-class>

<filter>

<filter-mapping>

  <filter-name>Myfilter</filter-name>

  <url-pattern>/myfilter</url-pattern>--指定过滤器应用的url

</filter-mapping>

创建并配置过滤器:

上一篇:饥荒补遗【一】物品


下一篇:饥荒补遗【二】界面