Struts2 2.5版本新配置filter-class

在web.xml 默认代码:


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

这里的StrutsPrepareAndExecuteFilter非常关键,因为Intellij的默认struts2框架版本还没有接纳2.5,所以是默认生成的web.xml文件会是老版本的东西。
另外这个地方飘红了,居然编译的时候没有在文件浏览器上标注出来,所以我就找了很久没注意到。
毕竟默认产生的程序运行不起来,我还以为是配置的问题呢。。。

猜你喜欢

转载自www.cnblogs.com/tieway59/p/10990356.html