Can I change the struts.xml file to anything else?

旧街凉风 提交于 2019-12-06 04:28:59

You can do that using your 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>

Also, if you use the struts.properties you can do something like:

struts.configuration.files=my-new-struts-config-file.xml,struts-plugin.xml,struts.xml 

You cannot change the name of struts.xml. You can, however, break up the Struts configuration among several configuration files which are named in strtus.xml.

For more details see this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!