From a Struts developer point of view, the one required configuration file used by the framework is web.xml
. From here, you have full control over how Struts configures both itself and your application. By default, Struts will load a set of internal configuration files to configure itself, then another set to configure your application, however it is possible to build an entire Struts application without writing a single configuration file other than web.xml
.
The table lists the files that you can use to configure the framework for your application. Some
Main Configuration Files
WebWork has two main configuration files you need to be aware of: web.xml and xwork.xml. Here you will find out all the information you need for both WebWork's required and optional configuration files.
Below are all the files that you may need to be aware of. Some of this configuration files can be reloaded dynamically, making development much easier. Dynamic reloading makes interactive development possible. See Reloading configuration for more information.
File | Optional | Location (relative to webapp) | Purpose |
---|---|---|---|
no | /WEB-INF/ | Web deployment descriptor to include all necessary WebWork framework components | |
xworkstruts.xml | no yes | /WEB-INF/classes/ | Main configuration, contains result/view types, action mappings, interceptors, etcand so forth |
webworkstruts.properties | yes | /WEB-INF/classes/ | WebWork Framework properties |
webworkstruts-default.xml | yes | /WEB-INF/lib/webworkstruts2-x.xcore.jar | Default configuration that should be included in xwork.provided by Struts |
yes | /WEB-INF/classes/ | Default macros referenced by | |
struts-plugin.xml | yes | At the root of a plugin JAR | Optional configuration files for Plugins in the same format as |
yes | /WEB-INF/classes/ | Override the default velocity Velocity configuration |
Static Content
Common static content that is needed by webwork the framework (JavaScript and CSS files, etc.) is server served automatically by the FilterDispatcher filter. Any request starting with "/
webworkstruts/
" denotes that static content is required, and then mapping the value after "/
webworkstruts/
" to common packages in WebWork the framework and, optionally in your 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 seperated 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).such as the password to a database).