Xml Struts2请求的资源不可用
我不熟悉struts。在tomcat上运行Struts应用程序时,出现请求的资源不可用的错误 我的目录结构是: struts.xmlXml Struts2请求的资源不可用,xml,struts2,Xml,Struts2,我不熟悉struts。在tomcat上运行Struts应用程序时,出现请求的资源不可用的错误 我的目录结构是: struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/stru
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- remove these constant elements in production -->
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="app02a" namespace="" extends="struts-default">
<action name="Product_input">
<result>/jsp/Product.jsp</result>
</action>
<action name="Product_save" class="app02a.Product" method="execute">
<result>/jsp/Details.jsp</result>
</action>
</package>
</struts>
请帮助我在
包
元素中缺少的内容,将名称空间
更改为“/”:
...
如果您使用的是struts-2.3.16.1,那么应该使用
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
支柱2
org.apache.struts2.dispatcher.ng.filter.strutspreadexecutefilter
请参见代码下方的注释 根据上面提到的URL,上面提到的struts.xml“app02”包有一些错误
http://localhost:8080/app02a/Product_input.action
而是使用struts默认包,它应该按照下面提到的方式进行更改
<package name="app02a" namespace="/app02a" extends="struts-default">
<action name="Product_input">......</action>
<action name="Product_save" class="app02a.Product" method="execute">....</action>
</package>
......
....
定义“包括所有罐子”;别让我们猜你在部署什么。
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
http://localhost:8080/app02a/Product_input.action
<package name="app02a" namespace="/app02a" extends="struts-default">
<action name="Product_input">......</action>
<action name="Product_save" class="app02a.Product" method="execute">....</action>
</package>