3

当我通过struts2时,我遇到了一个典型的问题。问题是我可以将struts.xml文件名更改为其他名称并使其正常工作吗?

4

2 回答 2

4

您可以使用您的web.xml

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    <init-param>
        <param-name>config</param-name>
        <param-value>my-new-struts-config-file.xml,struts-plugin.xml,struts.xml</param-value>
    </init-param>
</filter>

此外,如果您使用 ,struts.properties您可以执行以下操作:

struts.configuration.files=my-new-struts-config-file.xml,struts-plugin.xml,struts.xml 
于 2014-04-11T15:46:54.323 回答
-1

您不能更改 struts.xml 的名称。但是,您可以将 Struts 配置分解为几个在 strtus.xml 中命名的配置文件。

有关更多详细信息,请参阅此

于 2014-04-11T15:20:40.487 回答