FilterDispatcher <<< is deprecated! Please use the new filters!


                               WARNING!!!                                                                                         
                                                                                                                                          
 >>> FilterDispatcher <<< is deprecated! Please use the new filters! 
                                                                     
           This can be a source of unpredictable problems!           
                                                                     
              Please refer to the docs for more details!             
            http://struts.apache.org/2.x/docs/webxml.html            
                                                                     



在使用Struts时如果出现上面的错误,表示你的过滤器已经过时了

我们可以打开提示中的URL进行查看

发现新的web.xml 配置过滤器已经更改


<web-app id="WebApp_9" version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        <init-param>
            <param-name>actionPackages</param-name>
            <param-value>com.mycompany.myapp.actions</param-value>
        </init-param>
    </filter>
 
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
 
    <!-- ... -->
 
</web-app>

 新的过滤器地址 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter


我们往下看有说明 


Changed Filter Structure in Struts >= 2.1.3

Icon

To split up the the dispatcher phases, FilterDispatcher is deprecated since Struts 2.1.3. If working with older versions, you need to use


原来从2.1.3版本开始,旧的过滤器就已经失效拉。。。



爆款云服务器s6 2核4G 低至0.46/天,具体规则查看活动详情Blog Img