我下面这个教程打造我的第一个Struts2的例子。
我的项目名称(和战争文件还)是HelloWorld
,每当我尝试访问http://localhost:8080/HelloWorld/index.jsp
我得到
所请求的资源不可用。
我在Tomcat的webapps目录和tomcat我的战争文件运行良好。
我要去哪里错了?
我下面这个教程打造我的第一个Struts2的例子。
我的项目名称(和战争文件还)是HelloWorld
,每当我尝试访问http://localhost:8080/HelloWorld/index.jsp
我得到
所请求的资源不可用。
我在Tomcat的webapps目录和tomcat我的战争文件运行良好。
我要去哪里错了?
该教程是旧的。
它仍然采用org.apache.struts2.dispatcher.FilterDispatcher
,这是一个从Struts 2.1.8不赞成使用的过滤器 。
您需要使用新的过滤器: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
。
然后确保你有两个过滤器和过滤器映射在你的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>