servlet里的url-pattern和filter的pattern的区别

1.在servlet里面:

       <url-pattern>元素:在<servlet-mapping>里面映射访问URL;

   一般为:

<servlet>
    <servlet-name>CustomerServlet</servlet-name>
    <servlet-class>com.start.servlet.CustomerServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>CustomerServlet</servlet-name>
    <url-pattern>/CustomerServlet</url-pattern>
  </servlet-mapping></span>


2.在filter里面:

       <url-pattern>元素:用于指定过滤器关联的URL样式,设置为“/*”表示关联所有的URL.

  一般为:

<filter-mapping>
      <filter-name>过滤器类的类名</filter-name>
       <url-pattern>/*</url-pattern>
</filter-mapping></span>


你可能感兴趣的:(servlet,filter,struts2.0)