Apache Tomcat错误:请求的资源不可用 [英] Apache Tomcat error : The requested resource is not available

查看:7000
本文介绍了Apache Tomcat错误:请求的资源不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照本教程构建我的第一个Struts2示例.

I am following this tutorial to build my first Struts2 example.

我的项目名称(也包括war文件)为HelloWorld,并且每当我尝试访问时 http://localhost:8080/HelloWorld/index.jsp我知道

My project name (and war file also) is HelloWorld and whenever I try to access http://localhost:8080/HelloWorld/index.jsp I get

请求的资源不可用.

The requested resource is not available.

我的war文件在tomcat webapps目录中,并且tomcat运行良好.

I have my war file in tomcat webapps directory and tomcat is running fine.

我要去哪里错了?

推荐答案

该教程是旧的.

它仍然使用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>

这篇关于Apache Tomcat错误:请求的资源不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆