struts.xmlがデフォルト位置にないため、HTTP Status 404-There is no Actionmapped for namespace[/]and action name[

2239 ワード

mavenを使用して構築されたwebプロジェクトはstrutsをxmlはresourcesルートディレクトリの下に置くのではなくstruts 2/strutsに置く.xmlで
struts.xml不在默认位置,导致出现HTTP Status 404 - There is no Action mapped for namespace [/] and action name [_第1张图片
結果の実行エラー
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [userAction_login] associated with context path [/MyWeb].
解決策:プロファイルの場所を手動で指定する
Webでxmlファイルの下でstruts 2のfilterを変更する
init-paramの追加
<init-param>
    <param-name>config</param-name>
    <param-value>struts-default.xml,struts-plugin.xml,struts2/struts.xml</param-value>
</init-param>

問題解決
struts-defaultを再検索する必要があることに注意してください.xmlとstruts-plugin.xmlファイルの場所
上記のstruts-userなどのプロファイルを別々に書くとxmlファイルは、includeのときに相対パスとして書くも構成が見つからず、メインプロファイルstrutsでなければならない.xmlで使用
<include file="struts2/struts-user.xml">include>