Home > Guides > Core Developers Guide > Configuration Elements > Constant Configuration |
Constants provide a simple way to customize a Struts application by defining key settings that modify framework and plugin behavior. There are two key roles for constants. First, they are used to override settings like the maximum file upload size or whether the Struts framework should be in "devMode" or not, and so on. Second, they specify which Bean implementation, among multiple implementations of a given type, should be chosen.
Constants can be declared in multiple files. By default, constants are searched for in the following order, allowing for subsequent files to override previous ones:
The struts.properties
file is provided for backward-compatiblity with WebWork.
In the various XML variants, the constant element has two required attributes: name
and value
.
Attribute | Required | Description |
---|---|---|
name | yes | the name of the constant |
value | yes | the value of the constant |
In the struts.properties file, each entry is treated as a constant.
In the web.xml file, any FilterDispatcher initialization parameters are loaded as constants.