Struts 2 framework has two key configuration files:
struts.xml and struts.properties
One struts.xml document management applications is mainly responsible for the Action mapping, as well as the definition of Action contained in the Result. In addition, Struts 2 framework also includes a struts.properties file, which defines the Struts 2 framework of a large number of properties, developers can change these properties to meet the application requirements.
struts.properties file is a standard Properties file, which contains a series of key-value objects, each key is a Struts 2 property, the key corresponding value is a Struts 2 property value.
struts.properties file is usually placed on Web application WEB-INF/classes path. In fact, as long as the file on the Web application CLASSPATH path, Struts 2 framework can load the file.
In fact, struts.properties contents of the file available on the struts.xml in order to <constant name="" value=""> </ constant> load.
The following configuration parameters of the file to list in detail to facilitate you see;
This attribute specifies the Struts 2 configuration file loads the configuration file manager. The default value of the property org.apache.Struts2.config.DefaultConfiguration, which is Struts 2 default configuration file manager. If you need to achieve your own configuration manager, developers can achieve an implementation of Configuration interface class that can load their own Struts 2 configuration file.
The specified Web application's default Locale.
Specify the default encoding set of Web applications. The attribute request parameters for dealing with the Chinese is very useful, for access to the Chinese request parameter values, it should be the property value is set to GBK or GB2312.
When prompted to set the parameters for GBK, the equivalent of calling the setCharacterEncoding method of HttpServletRequest.
Specified Struts 2 default ObjectFactory Bean, the property default value is spring.
Spring framework specified automatic assembly mode, the default value of the property name, which is the default property name according to Bean's automated assembly.
This attribute specifies the Spring framework for integration, whether the cache Bean instance of the attribute only allows the use of true and false values of two properties, and its default value is true. Generally not recommended to modify the property value.
This attribute specifies the type of detection mechanism Struts 2, generally support the tiger and notiger two property values.
struts.multipart.parser: the property designated to deal with multipart / form-data of the MIME type (file upload) request the framework to support the property cos, pell, and jakarta such as property values, that correspond to the use of cos the file upload framework, pell upload and common-fileupload file upload framework. The default value for the property jakarta.
Note If you need to use cos or pell file upload method, it will be the corresponding JAR files to the Web application. For example, the use of cos uploads, you need to download cos framework JAR file and the file on the WEB-INF/lib path.
This attribute specifies the path to save the temporary upload files, the attribute's default value is javax.servlet.context.tempdir.
This attribute specifies the Struts 2 File upload the contents of the entire request to allow the maximum number of bytes.
This attribute specifies the Struts 2 application loading user-defined property file, the custom properties file specified attribute does not override the attributes specified in struts.properties file. If you need to load multiple custom properties file, a number of custom properties file name to English comma (,) separated.
Specifies the HTTP request is mapped to the specified Action mapping device, Struts 2 provides a default Mapper: org.apache.struts2.dispatcher.mapper.DefaultActionMapper. The default mapper prefix, upon request, with the completion of Action of the name attribute mapping.
This attribute specifies the need to deal with requests for Struts 2 suffix, the default value of this attribute is action, that all match the *. action requests handled by the Struts 2. If the user needs to specify more than one request for the suffix, then the number of suffixes in English between the comma (,) separated.
The property is passed the contents of JAR file provides static services, the property only supports true and false property value, the attribute's default property value is true.
The property is set if the browser is caching static content. When an application is in development stage, we hope that requests access to the server each time the latest response, you can set this property to false.
The property is set to Struts 2 whether to support the dynamic method calls, the property's default value is true. If you need to close the dynamic method calls, you can set this property to false.
The property is set to Struts 2 whether to allow the use of a slash in the Action name of the attribute's default value is false. If developers want to allow the use of a slash in the Action name, you can set this property to true.
This property specifies whether to allow the use of the Struts 2 tag expression syntax, which is usually the label will need to use the expression syntax, so property should be set to true, the property's default value is true.
The property is set whether to use Struts 2 application development model. If you set this attribute to true, you can be displayed when an error in the application of more and more friendly error message. This property only accepts true and flase two values, the property's default value is false. Typically, used in the development stage, this property is set to true, as enter the product release phase, then the property is set to false.
The properties are set for each HTTP request arrives, the system had to re-load the resource file. The attribute default value is false. In the development phase of this property is set to true will be more conducive to development, but in the product release stage should set the property to false.
Prompted the development phase of this attribute is set true, will be able to reload each time when they request an international resource file, which allows developers to see real-time development results; product release phase should be the attribute set to false, in order to to provide response performance, each request will need to re-load the resource file will greatly reduce the application performance.
This attribute specifies the default view of the view label theme, the property's default value is xhtml.
This attribute specifies the theme of the need to view the template file, the default value of the property template, which is the default template load path of the template file.
This attribute specifies the template file suffix, the attribute's default property value is ftl. This property also allows the use of ftl, vm or jsp, corresponding to FreeMarker, Velocity and JSP templates.
The property is set when the struts.xml file changes, the system is automatically re-load the file. The default value of the property is false.
This attribute specifies the required Velocity framework velocity.properties file. The default value for the property velocity.properties.
This attribute specifies the location of Velocity framework of Context, if the frame has more than one Context, then the number of Context in English between the comma (,) separated.
This attribute specifies the location of Velocity frame toolbox.
This attribute specifies the Web application where the listening port. This property is usually not much of users, only when the Struts 2 needs to be generated URL (for example, Url label), the property would only provide Web applications, the default port.
This property is similar to the role of struts.url.http.port property, the difference is the attribute specifies the cryptographic service port Web applications.
This attribute specifies whether the URL is generated Struts 2 contains the request parameters. The property received none, get, and all three attribute values, corresponding to does not contain only type that contains GET request parameters and contains all the request parameters.
This attribute specifies the Struts 2 applications require the internationalization of resource file, if multiple copies of an international resource file, then the number of resource file name to English comma (,) separated.
For some Java EE server, does not support the HttpServlet Request call getParameterMap () method, a time to set the property value to true to resolve the problem. The default value of the property is false. For WebLogic, Orion, and OC4J server, usually the property should be set to true.
This attribute specifies Struts 2 to use FreeMarker Manager. The default value of the property org.apache.struts2.views.freemarker.FreemarkerManager, this is Struts 2 built-in FreeMarker Manager.
This property only supports true and false values of two properties, the default value is true. Is usually no need to modify the property value.
This property specifies whether to use the style sheet XSLT Result cache. When an application is in development stage, the property is usually set to true; when applied at the product stage, the property is usually set to false.
This attribute specifies the framework of Struts 2 configuration file loaded by default, if you need to specify the default load multiple profiles, multiple configuration file's name in English between the comma (,) separated. The default value for the property struts-default.xml, struts-plugin.xml, struts.xml, see the property value, the reader should understand why the Struts 2 framework of the default load struts.xml file.