The core configuration file for the framework is the default (struts.xml) file and should reside on the classpath of the webapp (generally /WEB-INF/classes).

  • The default file may include other configuration files as needed.
  • A struts-plugin.xml file can be placed in a JAR and automatically plugged into an application, so that modules can be self-contained and automatically configured.
    • In the case of Freemarker and Velocity modules, the templates can also be loaded from the classpath, so the entire module can be plugged in as a single JAR.

FAQ

Can we break up a large struts.xml file into smaller pieces?

Next: struts.xml Examples

3 Comments

  1. Could we add something about the expected location of the struts.xml file? I spent endless hours trying to get Struts2 to work. If something like the following had appeared here in the documentation I might still have hair left.

    Expected Location:
    struts.xml is expected to be on the web application's classpath. It can be placed in WEB-INF/classes or packaged in the root of a jar and placed in WEB-INF/lib.

    1. Sorry, I didn't realize the Configuration Files page has this information. I swear it wasn't there yesterday even though it shows a last edit date of Feb 12, 2007.

      But having this information here would still be helpful. It would be nice if the web.xml, struts.properties pages also had the expected location stated.

      1. Added info regarding struts.xml location; thanks for the feedback. struts.properties has been largely replaced with XML configuration so I'm leaving that out. web.xml is a JEE file so I'm leaving that out as well.