且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Apache Tomcat错误:请求的资源不可用

更新时间:2022-06-13 22:40:51

该教程是旧的.

它仍然使用org.apache.struts2.dispatcher.FilterDispatcher,这是自Struts 2.1.8起已弃用的过滤器.

It still uses org.apache.struts2.dispatcher.FilterDispatcher , that is a deprecated filter since Struts 2.1.8.

您需要使用新的过滤器:org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.

You need to use the new filter: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.

然后确保在 web.xml 中正确设置了过滤器和过滤器映射:

Then ensure you have both the filter and the filter-mapping correctly set in your web.xml:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>