私は遅れています。ウェブアプリケーションのクラスパス内の任意のディレクトリにstruts.xmlを設定できますが、フィルタの「config」initパラメータを使用して場所を指定できます私のstruts.xmlファイルが "/ com/resources /"ディレクトリにある場合は、以下のようにweb.xmlの中で設定します。
<filter>
<filter-name>action</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-default.xml,struts-plugin.xml,/com/resources/struts.xml</param-value>
</init-param>
</filter>
私たちは、デフォルトで設定初期化パラメータStruts2のを提供していない場合は3つの値をとるが、「ストラット-default.xmlのを、struts.xml-plugin.xmlの支柱」、あなたは以下のStruts2のディスパッチャクラスコードを見ることができますこれら3つのファイルを構成マネージャーに構成します。
String configPaths = (String)this.initParams.get("config");
if (configPaths == null) {
configPaths = "struts-default.xml,struts-plugin.xml,struts.xml";
}
String[] files = configPaths.split("\\s*[,]\\s*");
for (String file : files)
if (file.endsWith(".xml")) {
if ("xwork.xml".equals(file))
this.configurationManager.addContainerProvider(createXmlConfigurationProvider(file, false));
else
this.configurationManager.addContainerProvider(createStrutsXmlConfigurationProvider(file, false, this.servletContext));
}
C:\ユーザー342008 \デスクトップ\ strus-structure.jpgその方法をしている間、私は404エラーを取得しています – jcrshankar