名前空間/およびアクション名「yourActionName」にマッピングされたアクションはありません
問題
多くのStruts 2開発者は、アクションクラスを適切に構成したが、アクションクラスにアクセスしているときにアクションエラーメッセージをヒットしたと主張しています。
2つのモードのエラーメッセージを参照してください。
1. 「struts.devMode」はオフになっています(デフォルト)
HTTP Status 404 - There is no Action mapped for namespace / and action name "yourActionName". type Status report message There is no Action mapped for namespace / and action name "yourActionName". description The requested resource (There is no Action mapped for namespace / and action name "yourActionName".) is not available.
2. struts.devMode is turn on
struts.xml
Struts Problem Report Struts has detected an unhandled exception: Messages: There is no Action mapped for namespace / and action name "yourActionName". Stacktraces There is no Action mapped for namespace / and action name "yourActionName". - [unknown location] com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178) org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) ... You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set: struts.devMode=false in your WEB-INF/classes/struts.properties file.
溶液
上記のエラーメッセージは、アクションクラスが利用できないことを示しています。これは、アクションクラスの構成で問題が発生したことを意味します。namespaceまたはtypoエラーの可能性があります。名前を再確認してください。
これがstruts.xml
ファイルの作業アクションクラス構成です。参照に使用できます。
pages/abc.jsp
プロジェクトのルートコンテキストが「Struts2Example」であると想定すると、このURLを介して上記のアクションにアクセスできます–
http://localhost:8080/Struts2Example/abcAction.action