当我研究 struts2 时,我遇到了一个典型的问题。
问题是我可以将 struts.xml
文件的名称更改为其他名称并使其正常工作吗?
最佳答案
您可以使用 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
关于xml - 我可以将 struts.xml 文件更改为其他任何文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23014481/