This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Can we break up a large struts.xml file into smaller pieces
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

Yes, there are two approaches. We can include other struts.xml file from a bootstrap, or we can place multiple struts.xml files on the classpath. Or both.


A typical struts.xml files will have one or more include elements:

    <include file="struts-default.xml"/>
    <include file="config-browser.xml"/>
    <package name="default" extends="struts-default">
    <include file="other.xml"/>

The first include element tells the framework to load the struts-default.xml, which it wil find in the struts2.jar file. The struts-default.xml file defines the "standard" interceptor and result definitions.

You can put your own <include> elements in your struts.xml interchangeably with <package> elements. They configuration objects will be loaded order of appearance. The framework reads the configuration from top to bottom and adds objects as they are referenced.

@see com.opensymphony.xwork.config.ConfigurationManager
@see com.opensymphony.xwork.config.Configuration
@see com.opensymphony.xwork.config.impl.DefaultConfiguration
@see com.opensymphony.xwork.config.ConfigurationProvider
@see com.opensymphony.xwork.config.providers.XmlConfigurationProvider


A "modular" application may have several struts.xml files placed in various packages on the classpath.

At startup, the framework will search down the classpath for struts.xml files and load each one, honoring any include statements.

  • No labels