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

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Points to <include> configuration docs now.

Yes, there are two complementary approaches. We can include other struts.xml file -format files from a bootstrap struts.xml file, or we can package a struts.xml files in a JAR. Or both.

By Include

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 will find in the struts2.jar file. The struts-default.xml file defines the "standard" interceptor and result definitions.

You can put your own See the <include> element documentation.

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