2.4. Using Multiple Struts Configuration Files
Problem
You want to break apart a large struts-config.xml file into smaller files for improved organization and easier maintenance, particularly in a team environment.
Solution
Split your monolithic struts-config.xml into
multiple configuration files. Each file must be well-formed and valid
according to the struts-config XML DTD.
Reference these files as the value for the config
initialization parameter of the ActionServlet in
the web.xml file as shown in Example 2-9.
Example 2-9. Multiple config files (single module)
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config.xml,
/WEB-INF/struts-config-2.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>When the ActionServlet is loaded, Struts will
merge the results of the specified configuration files into a single
in-memory configuration.
Discussion
For anything other than the most trivial applications, the
struts-config.xml file tends to get large and
unwieldy. Many applications may have action
elements numbering in the hundreds. Combine this with the use of a
locking source control system, and soon you will have developers in
constant contention for the same file.
Struts 1.1 introduced support for multiple configuration files. Each configuration file must be a valid XML file and conform to the struts-config XML Document ...