Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

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

By Include

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

Sure, that's what the <include> element is for. Most xwork.xml files
already have one:

Code Block

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

This tells it to load the webwork-default.xml from the webwork jar file
to get all of those interceptor and result definitions.

You can put your own <include> in your xwork.xml interchangeably with
<package> elements... They will be loaded in the same order as it reads
from top to bottom and adds things as it reads themobjects as they are referenced.

By JAR

A "module" can be added to an application by placing a struts.xml and related classes into a JAR on the classpath. FreeMarker and Velocity templates can also be provided by JAR, making it possible to distribution a module in a single, self-contained JAR that is automatically configured on startup.