码迷,mamicode.com
首页 > 移动开发 > 详细

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [Action!Method]错误解决

时间:2015-01-14 21:09:30      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:

按照书本上的Struts2的例子,运行会出现错误:

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [sayHelloAction!sayStruts2] ...

 貌似在struts.xml中配置action的method不会出错,而直接在jsp中写“Action!Method.action”就会报错。

搜索许久没有发现解决办法,后来发现第二种写法叫做“DMI”,会产生安全隐患,在struts2的某个版本后就默认关闭了(我使用的是Struts 2-2.3.20)。于是在struts.xml的<struts></struts>中添加下面一行即可:

<constant name="struts.enable.DynamicMethodInvocation" value="true" />

 

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [Action!Method]错误解决

标签:

原文地址:http://www.cnblogs.com/afeng7882999/p/4224757.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!