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

编程入门 行业动态 更新时间:2024-10-28 09:26:26
本文介绍了Apache Tomcat错误:请求的资源不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

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

My project name (and war file also) is HelloWorld and whenever I try to access 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错误:请求的资源不可用

本文发布于:2023-11-25 04:24:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1628311.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不可用   错误   资源   Apache   Tomcat

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!