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


按照书本上的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" />

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM