Detailed description of Struts. properties file of struts2

Source: Internet
Author: User

Struts. properties file details

This article is reproduced from Li Gang's <struts 2 authoritative guide: webwork-based MVC development>

The Struts. properties file is a standard properties file that contains a series of key-value objects. Each key is a struts2 attribute, and the value corresponding to this key is a struts2 attribute value.

Struts. propertis files are usually placed under the WEB-INF/classes path of the Web application. In fact, the struts2 framework can load the file by placing the file in the classpath path of the Web application.

The question is, which keys in the Struts. properties file are valid? Which of the following attributes are valid in the Struts. properties file. The struts2 attributes that can be defined in struts. properties are listed below.

> Struts. Configuration: This attribute specifies the configuration file manager for loading the struts2 configuration file. The default value of this attribute is Org. apache. struts2.config. defaultconfiguration, which is the default configuration file manager of struts2. If developers need to implement their own Configuration Manager, developers can implement a class that implements the configuration interface, which can load the struts2 configuration file by themselves.

> Struts. locale: Specifies the default locale of the Web application.

> Struts. i18n. encoding: Specifies the default deployment set of the Web application. This attribute is very useful for processing Chinese Request Parameters. For obtaining Chinese request parameter values, set this attribute value to GBK or gb2312.

Tip: When this parameter is set to GBK, it is equivalent to calling the setcharacterencoding method of httpservlerequest.

> Struts. objectfactory: Specifies the default objectfactory bean of struts2. The default value of this attribute is spring.

> Struts. objectfactory. Spring. autowire: 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. The default value is true. We do not recommend that you modify this attribute.

> Struts. objecttypedeterminer: This attribute specifies the struts2 type detection mechanism. Generally, 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 respectively. The default value of this attribute is Jakarta.

NOTE: If cos or Pell is required for file upload, copy the corresponding JAR file to the Web application. For example, to use the COs upload method, you need to download the COs framework JAR file, 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 the struts2 file upload.

> Struts. Custom. properties: This attribute specifies that the struts2 application loads a 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. struts2 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 struts2. The default value of this attribute is action, that is, all requests matching *. Action are processed by struts2. If you need to specify multiple request suffixes, multiple suffixes are separated by commas.

> Struts. Serve. Static: whether to use the JAR file to provide static content services. This attribute only supports true and false attribute values, and the default attribute value 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 whether struts2 supports 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 struts2 allows the use of diagonal lines in the action name. The default value of this attribute is false. If the developer wants to allow the use of diagonal lines in the action name, set this attribute to true.

> Struts. tag. altsyntax: This attribute specifies whether expression syntax can be used in the struts2 tag. Because expression syntax is usually used in the tag, the attribute should be set to true, and the default value of this attribute is true.

> Struts. devmode: This attribute sets whether the struts2 application uses the development mode. If this attribute is set to true, more and more error-friendly prompts 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.

Tip: When this attribute is set to true in the development stage, the international resource file can be reloaded in 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 value is XHTML.

> Struts. UI. templatedir: This attribute 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 after the Struts. xml file is changed. 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 usually does not have a large number of users. It only provides the default web application port when struts2 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 in the URL generated by struts2. This property accepts none, get, and all attributes, which are not included, including only GET Request Parameters and all request parameters.

> Struts. custom. i18n. resources: This attribute specifies the international resource files required by the struts2 application. If there are multiple international resource files, the names of these resource files are separated by commas.

> Struts. Dispatcher. parametersworkaround: for some java EE servers, httpservletrequest does not support calling the getparametermap () method. 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 struts2. The default value of this attribute is org. Apache. struts2.views. freemarker. freemarkermanager, which is the built-in freemarker manager of struts2.

> Struts. freemarker. wrapper. altmap: This attribute can only be set to true or false. The default value is true. You do not need to modify the attribute value.

> Struts. XSLT. nocache: This attribute specifies whether the XSLT result is cached in the style sheet. 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 struts2 framework. To specify multiple configuration files to be 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 struts2 framework loads the Struts. xml file by default.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.