Search code examples
configurationstruts2struts

Struts 2 how to specify configuration file location outside class path


I am trying set a init-param for struts 2 filter like this:

<init-param>
    <param-name>config</param-name>
    <param-value>struts-default.xml,struts-plugin.xml,/WEB-INF/etc/struts.xml</param-value>
</init-param>

but it does't work. Can't we put struts 2 configuration file outside class path?


Solution

  • No, you can't, but you can specify a relative path

    <param-value>struts-default.xml,struts-plugin.xml,../etc/struts.xml</param-value>