Shiva Mothkuri
Shiva Mothkuri

Reputation: 307

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

When I'm going though struts2, I came through a typical question. The question is that can I change the name of struts.xml file to some other thing and make it work?

Upvotes: 3

Views: 1328

Answers (2)

Garis M Suero
Garis M Suero

Reputation: 8169

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 

Upvotes: 4

hatellla
hatellla

Reputation: 5132

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

Upvotes: -1

Related Questions