当前位置: 代码迷 >> J2EE >> 生手,web项目中,web.xml里面的东西搞不懂啊
  详细解决方案

生手,web项目中,web.xml里面的东西搞不懂啊

热度:32   发布时间:2016-04-17 23:26:25.0
新手,web项目中,web.xml里面的东西搞不懂啊,
谁能给解释下啊
	<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.dwr</url-pattern>
</filter-mapping>
<!-- 让hibernate open session in view的荣光也照耀xfire -->
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/service/*</url-pattern>
</filter-mapping>
<!-- 页面元素的GZIP压缩 Filter,减少网络带宽 -->
<filter-mapping>
<filter-name>compressFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
     <param-name>targetFilterLifecycle</param-name>
      <param-value>true</param-value>
    </init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> 

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
<dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>SessionFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SessionFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SessionFilter</filter-name>
<url-pattern>/*Servlet</url-pattern>
</filter-mapping>

------解决思路----------------------
当你request的请求参数类型满足filter-mappiing下的url-pattern的值时就会被过滤,你只截了一半吧,还有每个过滤器对应配置的类,满足条件的话,就会进入过滤器的类里面进行处理
  相关解决方案