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