Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Configuration Files
Added by ctran, last edited by Ted Husted on Sep 03, 2006  (view change)

Two key configuration files utilized by the framework are web.xml and struts.xml. The configuration elements in these two files will reference any other required or optional configuration files.

The table lists the files that you can use to configure the framework for your application. Some configuration files can be reloaded dynamically. Dynamic reloading makes interactive development possible. See Reloading configuration for more.

File Optional Location (relative to webapp) Purpose
web.xml no /WEB-INF/ Web deployment descriptor to include all necessary framework components
struts.xml no /WEB-INF/classes/ Main configuration, contains result/view types, action mappings, interceptors, and so forth
struts.properties yes /WEB-INF/classes/ Framework properties
struts-default.xml yes /WEB-INF/lib/struts-action-x.x.jar Default configuration that should be included in struts.xml
velocity.properties yes /WEB-INF/classes/ Override the default Velocity configuration
struts-default.vm yes /WEB-INF/classes/ Default macros referenced by velocity.properties

Static Content

Common static content that is needed by the framework (JavaScript and CSS files, etc.) is served automatically by the FilterDispatcher filter. Any request starting with "/struts/" denotes that static content is required, and then mapping the value after "/struts/" to common packages in Struts 2 and, optionally in the application's class path.

By default, the following packages are searched:

  • org.apache.struts2.static
  • template

Additional packages can be specified by providing a comma separated list to the configuration parameter named "packages" (configured in web.xml for the FilterDispatcher filter). When specifying additional static content, you should be careful not to expose sensitive configuration information (i.e. database password).

Next: Struts Configuration Elements