The struts 2 framework has two core configuration files:
Struts. xml and Struts. Properties
The Struts. xml file is mainly used to manage the action ing in the application and the result definition contained in the action. In addition, the struts 2 framework also contains a struts. properties file that defines a large number of attributes of the struts 2 framework. developers can change these attributes to meet application requirements.
Struts. the properties file is a standard properties file that contains a series of key-value objects. Each key is a struts 2 attribute, and the value corresponding to the key is a struts 2 attribute value.
Struts. properties files are typically placed in the WEB-INF/classes path of the Web application. In fact, the struts 2 framework can load the file by placing the file in the classpath path of the Web application.
In fact, the content of the Struts. properties file can be loaded in struts. XML with <constant name = "" value = ""> </constant>.
The following lists the configuration parameters of the file for your convenience;Struts. Configuration
Struts. i18n. Encoding
Specifies the default set of web applications. This attribute is very useful for processing Chinese Request Parameters. For obtaining Chinese request parameter values, set this attribute value to GBK or gb2312.
If this parameter is set to GBK, The setcharacterencoding method of httpservletrequest is called.
Specify the default objectfactory bean of struts 2. The default value of this attribute is spring.
Struts. objectfactory. Spring. autowrite
Specifies the automatic assembly mode of the Spring framework. The default value of this attribute is name, which means automatic assembly based on the bean name attribute by default.
Struts. objectfactory. Spring. useclasscache
This attribute specifies whether to cache bean instances when integrating the Spring framework. This attribute only allows the use of true and false attribute values. Its default value is true. We do not recommend that you modify this attribute.
Struts. objecttypedeterminer this attribute specifies the type detection mechanism of struts 2. Generally, the two attribute values tiger and notiger are supported.
Struts. multipart. parser: This attribute specifies the framework for processing multipart/form-data MIME type (File Upload) requests. This attribute supports attribute values such as cos, Pell, and Jakarta, that is, it corresponds to the COs File Upload framework, Pell upload, and common-fileupload File Upload framework. The default value of this attribute is Jakarta.
Note: If you need to upload cos or Pell files, copy the corresponding jar files to the Web application. For example, to use the COs upload method, you need to download the JAR file of the CoS framework and put the file in the WEB-INF/lib path.
Struts. multipart. savedir this attribute specifies the temporary storage path of the uploaded file. The default value of this attribute is javax. servlet. Context. tempdir.
Struts. multipart. maxsize this attribute specifies the maximum number of bytes allowed for the entire request content during struts 2 file upload.
Struts. Custom. properties This attribute specifies that the struts 2 Application loads the custom property file. The property specified in this custom property file does not overwrite the property specified in the Struts. properties file. If you need to load multiple custom property files, the names of multiple custom property files are separated by commas.
Struts. Mapper. Class specifies to map HTTP requests to the er of the specified action. Struts 2 provides the default er org. Apache. struts2.dispatcher. Mapper. defaultactionmapper. By default, the er maps the request prefix to the action name attribute.
Struts. Action. Extension this attribute specifies the request suffix to be processed by struts 2. The default value of this attribute is action, that is, all requests matching *. Action are processed by struts 2. If you need to specify multiple request suffixes, multiple suffixes are separated by commas.
Struts. Serve. Static this attribute sets whether to provide static content services through the JAR file. This attribute only supports true and false attribute values. The default attribute value of this attribute is true.
Struts. Serve. Static. browsercache this attribute sets whether the browser caches static content. When an application is in the development stage, you can set this attribute to false if you want to obtain the latest response from the server for each request.
Struts. Enable. dynamicmethodinvocation this attribute sets struts 2 to support dynamic method calls. The default value of this attribute is true. To disable dynamic method calling, set this attribute to false.
Struts. Enable. slashesinactionnames this attribute sets whether struts 2 allows diagonal lines in the action name. The default value of this attribute is false. If you want to allow a slash in the action name, you can set this attribute to true.
Struts. tag. altsyntax specifies whether expression syntax can be used in struts 2 labels. Because expression syntax is usually used in labels, the attribute should be set to true, and the default value of this attribute is true.
Struts. devmode this attribute sets whether the struts 2 application uses the development mode. If this attribute is set to true, more and more friendly error messages can be displayed when an application error occurs. This attribute only accepts the true and flase values. The default value of this attribute is false. Generally, an application sets this attribute to true during development. when the product is released, this attribute is set to false.
Struts. i18n. reload this attribute sets whether the system reloads the resource file every time an HTTP request arrives. The default value of this attribute is false. Setting this attribute to true during development is more conducive to development, but it should be set to false during product release.
Prompt that the property is set to true in the development phase, and the international resource file can be re-loaded upon each request, so that developers can see the real-time development effect; this attribute should be set to false in the product release phase to provide response performance. re-loading the resource file for each request will greatly reduce the application performance.
Struts. UI. Theme this attribute specifies the default view topic of the view tag. The default value of this attribute is XHTML.
Struts. UI. templatedir specifies the location of the template file required by the view topic. The default value of this attribute is template, that is, the template file under the template path is loaded by default.
Struts. UI. templatesuffix this attribute specifies the suffix of the template file. The default attribute value of this attribute is FTL. This attribute also allows FTL, Vm, or JSP to correspond to freemarker, velocity, and JSP templates respectively.
Struts. configuration. xml. reload this attribute sets whether the system automatically reloads the file when the Struts. xml file changes. The default value of this attribute is false.
Struts. Velocity. configfile this attribute specifies the location of the velocity. properties file required by the velocity framework. The default value of this attribute is velocity. properties.
Struts. Velocity. contexts this attribute specifies the context position of the velocity framework. If the framework has multiple contexts, multiple contexts are separated by commas.
Struts. Velocity. toolboxlocation this attribute specifies the location of the toolbox of the velocity framework.
Struts. url. http. Port this attribute specifies the listening port of the Web application. This attribute is usually not large for users. It only provides the default port for Web Applications When struts 2 needs to generate a URL (such as a URL tag.
Struts. url. HTTPS. Port this attribute is similar to the Struts. url. http. Port attribute. The difference is that this attribute specifies the encrypted service port of the Web application.
Struts. url. includeparams this attribute specifies whether the request parameters are included when struts 2 generates a URL. This property accepts none, get, and all attributes, which correspond to request parameters that do not contain, contain only get parameters, and contain all request parameters.Struts. custom. i18n. resources this attribute specifies the international resource files required by the struts 2 application. If there are multiple international resource files, the names of these resource files are separated by commas. Struts. Dispatcher. parametersworkaround does not support httpservlet request calling the getparametermap () method on some java EE servers. You can set this attribute value to true to solve this problem. The default value of this attribute is false. This attribute should be set to true for WebLogic, Orion, and Solaris servers.
Struts. freemarker. Manager. classname this attribute specifies the freemarker manager used by struts 2. The default value of this attribute is org. Apache. struts2.views. freemarker. freemarkermanager, which is the built-in freemarker manager of struts 2.
Struts. freemarker. wrapper. altmap this attribute only supports the true and false attribute values. The default value is true. You do not need to modify the attribute value.
Struts. XSLT. nocache this attribute specifies whether the XSLT result uses the style sheet cache. This attribute is usually set to true when the application is in the development stage. When the application is in the product use stage, this attribute is usually set to false.
Struts. configuration. files this attribute specifies the default configuration file loaded by the struts 2 framework. If you need to specify that multiple configuration files are loaded by default, the names of multiple configuration files are separated by commas. The default value for this property is struts-default.xml, struts-plugin.xml, Struts. XML, and the reader should understand why the struts 2 Framework loads the struts. xml file by default.