今天搭建struts2小项目,却一只提示
“There is no Action mapped for namespace [/] and action name [XXX]... ”
代码看了一遍又一遍,也找了很多资料,就是解决不了
下面说下解决方法:
1,struts.xml文件所在位置
默认应放在src源码下,如果放在其他位置,需配置web.xml
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-default.xml,struts-plugin.xml,struts2/struts.xml</param-value>
</init-param>
</filter>
2,namespace 配置错误
最简单的方法是不设置na'mespace
其他的方法可以百度
3,拼写错误
这个就没办法了,根据log信息自己看呗