1.<constant name="struts.i18n.encoding" value="UTF-8" />
Specifies the default encoding set of the web application, which is equivalent to calling the setCharacterEncoding method of HttpServletRequest.
2.<constant name="struts.i18n.reload" value="false"/>
This property sets whether the system reloads the resource file every time an HTTP request arrives. The default value of this property is false. Setting this property to true during the development stage will be more conducive to development, but it should be set to false during the product release stage.
3.<constant name="struts.custom.i18n.resources" value="application"/>
This property specifies the international resource file required by Struts 2 applications. If there are multiple international resource files, the file names of the multiple resource files are separated by English commas (,).
4.<constant name="structs.action.extension" value="action" />
This property specifies the request suffix that needs to be processed by Struts 2. The default value of this property is action, that is, all requests matching *.action are processed by Struts 2. If the user needs to specify multiple request suffixes, the multiple suffixes are separated by an English comma (,).
5.<constant name="struts.serve.static.browserCache " value="true" />
Set whether the browser caches static content. The default value is true (used in production environment), and it is best to close the development stage.
6.<constant name="struts.configuration.xml.reload" value="false" />
When the configuration file of struts 2 is modified, the system will automatically reload the file. The default value is false (used in production environment), and it is best to open it in the development stage.
7.<constant name="struts.configuration.files" value="struts-default.xml,struts-plugin.xml,struts.xml"/>
This property specifies the configuration file loaded by the Struts 2 framework by default. If you need to specify that multiple configuration files are loaded by default, the file names of the multiple configuration files are separated by English commas (,). The default value of this property is struts- default.xml, struts-plugin.xml, struts.xml. When you see the value of this property, readers should understand why the Struts 2 framework loads the struts.xml file by default.
8.<constant name="struts.configuration" value="org.apache.struts2.config.DefaultConfiguration"/>
Specify loading struts2 configuration file manager, which is default to org.apache.struts2.config.DefaultConfiguration. Developers can customize the configuration file manager. This class can automatically load struts2 configuration files to implement the Configuration interface.
8.<constant name="struts.continuations.package" value=""/>
Completely continuous package name containing Actions.
10.<constant name="struts.devMode" value="true" />
Used in development mode, so that more detailed error information can be printed.
11.<constant name="struts.serve.static.browserCache" value="false"/>
This property sets whether the browser caches static content. When the application is in development stage, we want each request to get the latest response from the server, so we can set this property to false.
12.<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
This property sets whether Struts 2 supports dynamic method calls, and the default value of this property is true. If you need to turn off dynamic method calls, you can set this property to false.
13.<constant name="struts.enable.SlashesInActionNames" value="false"/>
This property sets whether Struts 2 allows slashes to be used in Action names, and the default value of this property is false. If the developer wants to allow slashes in the Action name, then the property can be set to true.
14.<constant name="struts.tag.altSyntax" value="true"/>
This property specifies whether expression syntax is allowed in Struts 2 tags, because it is usually necessary to use expression syntax in tags, so the property should be set to true, and the default value of this property is true.
15.<constant name="struts.devMode" value="false"/>
This property sets whether the Struts 2 application uses development mode. If this property is set to true, more and more friendly error prompts can be displayed when an error occurs on an application. This property only accepts two values: true and flase, and the default value of this property is false. Usually, when the application is in the development stage, the property is set to true, and when it enters the product release stage, the property is set to false.
16.<constant name="struts.ui.theme" value="xhtml"/>
This property specifies the default view theme of the view tag. The default value of this property is xhtml, which can be simple, xhtml or ajax.
17.<constant name="struts.ui.templateDir" value="template"/>
This property specifies the location of the template file required for the view theme. The default value of this property is template, that is, the template file under the template path is loaded by default.
18.<constant name="struts.ui.templateSuffix" value="ftl"/>
This property specifies the suffix of the template file, and the default property value of the property is ftl. This property also allows the use of ftl, vm, or jsp, corresponding to FreeMarker, Velocity and JSP templates, respectively.
19.<constant name="struts.velocity.configfile" value="velocity.properties"/>
This property specifies the location of the velocity.properties file required by the Velocity framework. The default value of this property is velocity.properties.
20.<constant name="struts.velocity.contexts" value=""/>
This property specifies the Context position of the Velocity framework. If the framework has multiple Contexts, the multiple Contexts are separated by English commas (,).
21.<constant name="struts.velocity.toolboxlocation" value=""/>
This property specifies the location of the toolbox of the Velocity framework.
22.<constant name="struts.url.http.port" value="80"/>
This property specifies the listening port on which the web application is located. This property is usually not very useful, but only when Struts 2 needs to generate a URL (such as a Url tag), this property provides the default port for the web application.
23.<constant name="struts.url.https.port" value="443"/>
This property is similar to the role of the struts.url.http.port property, the difference is that this property specifies the encryption service port of the web application.
24.<constant name="struts.url.includeParams" value="none|get|all"/>
This property specifies whether Struts 2 contains request parameters when generating the URL. This property accepts three attribute values: none, get and all, which correspond to not including, only including GET type request parameters and including all request parameters.
25.<constant name="struts.dispatcher.parametersWorkaround" value="false"/>
For some Java EE servers, the HttpServlet Request calls the getParameterMap() method is not supported. At this time, the property value can be set to true to solve the problem. The default value of this property is false. For WebLogic, Orion, and OC4J servers, this property should usually be set to true.
26.<constant name="struts.freemarker.manager.classname" value=""/>
This property specifies the FreeMarker manager used by Struts 2. The default value of this property is org.apache.struts2.views.freemarker.FreemarkerManager, which is the built-in FreeMarker manager for Struts 2.
27.<constant name="struts.freemarker.wrapper.altMap" value="true"/>
This property only supports two attribute values: true and false, and the default value is true. Usually there is no need to modify the property value.
28.<cosntant name="struts.freemarker.templatesCache" value="false" />
Set whether to set cache for freemarker templates, the effect is equivalent to copying templates to WEB_APP/templates.
29.<constant name="struts.xslt.nocache" value="false"/>
This property specifies whether XSLT Result uses stylesheet cache. This property is usually set to true when the application is in the development stage; this property is usually set to false when the application is in the product usage stage.
30.<constant name="struts.custom.properties" value="application,org/apache/struts2/extension/custom
"/>
Specifies that the Struts2 application loads a user-defined property file. The properties specified by the custom property file will not override the properties specified in the struts.properties file. If multiple custom properties files need to be loaded, the file names of multiple custom properties files are separated by English commas (,). (That is, don't rewrite struts.properties!)
31.<constant name="struts.locale" value="zh_CN"/>
Default internationalized region information.
32.<constant name="struts.mapper.class" value="org.apache.struts2.dispatcher.mapper.DefaultActionMapper"/>
Specify the request url and action mapper, default is org.apache.struts2.dispatcher.mapper.DefaultActionMapper
33.<cosntant name="struts.mapper.alwaysSelectFullNamespace" value="false" />
Set whether to select namespace at any location before the last slash
34.<constant name="struts.multipart.maxSize" value="2097152"/>
The maximum size of multipart request information (for file upload, this property specifies the maximum number of bytes allowed for the entire request content in Struts 2 file upload).
35.<constant name="struts.multipart.parser" value="cos"/>
This property specifies processing MIME-type multipart/form-data, file upload (cos, pelll, jakarta)
The org.apache.struts2.dispatcher.multipart.MultiPartRequest parser interface (for file upload) specially used for multipart request information.
36.<constant name="struts.multipart.saveDir" value="/tmpuploadfiles"/>
Specifies the temporary directory when uploading files, and uses javax.servlet.context.tempdir by default.
37.<constant name="structs.objectFactory" value="spring" />
This property specifies that the Action in Struts 2 is created by the Spring container.
38.<constant name="structs.objectFactory.spring.autoWire" value="name"/>
Specify the assembly mode of the spring framework, the assembly methods are: name, type, auto, and constructor (name is the default assembly mode)
39.<constant name="structs.objectFactory.spring.useClassCache" value="true"/>
This property specifies whether the bean is cached when integrating spring. The value is true or false, and the default is true.
40.<cosntant name="struts.objectTypeDeterminer" value="tiger" />
Specify type checking, including tiger and nottiger
Detailed explanation of constant configuration in struts2
This article mainly explains the constant constant configuration in struts2, and the content mainly comes from the Internet.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts><!--Specify the default encoding set of the web application. This property is very useful for processing Chinese request parameters. For obtaining the value of the Chinese request parameter, the property value should be set to GBK or GB2312 Tip: When setting this parameter to GBK, it is equivalent to calling the setCharacterEncoding method of HttpServletRequest><constant name="struts.i18n.encoding" value="UTF-8" /> <!--Specify the default ObjectFactory Bean of Struts2. The default value of this property is spring.><constant name="struts.objectFactory" value="spring" /> <!--Specify the automatic assembly mode of the Spring framework. The default value of this property is name, that is, the default assembly is automatically based on the name attribute of the bean. ><constant name="struts.objectFactory.spring.autoWire" value="name" /> <!--This property specifies whether to cache Bean instances when integrating Spring framework. This property only allows two attribute values to be used, true and false, and its default value is true. It is usually not recommended to modify the attribute value.><constant name="structs.objectFactory.spring.useClassCache" value="true" /> <!--This property specifies the framework for handling MIME type (file upload) requests of multipart/form-data. This property supports attribute values such as cos, pell and jakarta, that is, corresponding to the file upload framework using cos, pell and common-fileupload file upload frameworks. The default value of this property is jakarta. Note: If you need to use cos or pell file upload method, you should copy the corresponding JAR file to the web application. For example, if you use cos upload method, you need to download the JAR file of the cos framework yourself and place the file under the WEB-INF/lib path. ><constant name="struts.multipart.parser" value="jakarta" /> <!--This property specifies the temporary saving path of the uploaded file. The default value of this property is javax.servlet.context.tempdir. ><constant name="struts.multipart.saveDir" value="" /> <!--This property specifies the maximum number of bytes allowed for the entire requested content in the upload of Struts 2 file. ><constant name="struts.multipart.maxSize" value="10000000000" /> <!--This property specifies the request suffix that needs to be processed by Struts 2. The default value of this property is action, that is, all requests matching *.action are processed by Struts 2. If the user needs to specify multiple request suffixes, the multiple suffixes are separated by English commas (,). ><constant name="struts.action.extension" value="do" /> <!--This property sets whether to provide static content services through a JAR file. This property only supports true and false attribute values, and the default attribute value of this property is true. ><constant name="struts.serve.static" value="true" /> <!--This property sets whether the browser caches static content. When the application is in the development stage, we want each request to get the latest response from the server, so we can set the property to false. ><constant name="struts.serve.static.browserCache" value="true" /> <!--This property sets whether the application uses development mode. If the property is set to true, more and more friendly error prompts can be displayed when an application error occurs. This property only accepts two values, true and flase, and the default value of this property is false. Usually, when the application is in the development stage, the property is set to true. When the product release stage enters the product release stage, the property is set to false. ><constant name="struts.devMode" value="false" /> <!--This property sets whether the system reloads the resource file every time an HTTP request arrives (allowing international file reload). The default value of this property is false. Setting this property to true in the development stage will be more conducive to development, but it should be set to false in the product release stage. Tip: Setting this property to true in the development stage will allow the international resource file to be reloaded every time the request is to allow developers to see real-time development results; the property should be set to false in the product release stage, in order to provide responsive performance, and reloading the resource file for each request will greatly reduce the performance of the application. ><constant name="struts.i18n.reload" value="false" /> <!--This property specifies the default view theme of the view label, and the default value of this property is xhtml. ><constant name="struts.ui.theme" value="simple" /> <!--This property specifies the suffix of the template file, and the default attribute value of the attribute is ftl. This property also allows ftl, vm or jsp to correspond to FreeMarker, Velocity and JSP templates respectively. ><constant name="struts.ui.templateSuffix" value="ftl" /> <!--This property sets whether the system will automatically reload the file after the struts.xml file is changed. The default value of this property is false. ><constant name="struts.configuration.xml.reload" value="false" /> <!--This property specifies the international resource file required by the Struts 2 application. If there are multiple international resource files, the file names of the multiple resource files are separated by English commas (,). ><constant name="struts.custom.i18n.resources" value="nationz" /> <!--For some Java EE servers, the HttpServlet Request call getParameterMap() method is not supported. At this time, the property value can be set to true to solve the problem. The default value of this property is false. For WebLogic, Orion, and OC4J servers, the property should usually be set to true. ><constant name="struts.dispatcher.parametersWorkaround" value="false" /> <!--Specify whether to cache FreeMarker templates. The default value is false.><constant name="struts.freemarker.templatesCache" value="true" /> <!--This property only supports two attribute values, true and false, and the default value is true. Usually there is no need to modify the attribute value. ><constant name="struts.freemarker.wrapper.altMap" value="true" /> <!--This property specifies whether XSLT Result uses stylesheet cache. When the application is in the development stage, the property is usually set to true; when the application is in the product usage stage, the property is usually set to false. ><constant name="struts.xslt.nocache" value="false" /> <!--This property specifies Struts 2 The configuration file loaded by the framework by default. If you need to specify that multiple configuration files are loaded by default, the file names of multiple configuration files are separated by English commas (,). The default values of this attribute are struts-default.xml, truts-plugin.xml, struts.xml. You should understand why the Struts 2 framework loads struts.xml by default. ><constant name="struts.configuration.files" value="struts-default.xml, struts-plugin.xml" /> <!--Set whether the mapper always selects the complete namespace. When the default value of this attribute is false.><constant name="struts.mapper.alwaysSelectFullNamespace" value="false" /> <!--Set the root path of the Convention plug-in to locate the view resource. The default value is /WEB-INF/content><constant name="struts.convention.result.path" value="/WEB-INF/content/" /> <!--Convention plug-in specifies the package as the root package with this constant><constant name="struts.convention.action.package" value="default" /> <!-- Whether to search for Action><constant name="struts.convention.action.disableScanning" value="false"/> <!-- The official only states that it needs to be set under jboss, and the situation is unknown--><constant name="struts.convention.exclude.parentClassLoader" value="true" /> <constant name="struts.convention.action.fileProtocols" value="jar, zip" /> <!--Include what jar packages are action.comma-segmented strings.><constant name="struts.convention.action.includeJars" value=".*?/_wl_cls_gen.*?jar(!/)?" /> <!--Determine the path to search for packages. As long as the package ends with action, search for them.><constant name="struts.convention.package.locators" value="action" /> </struts>
Struts2 - Commonly used constant summary
See comments
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd"><struts> <!-- Set it to development mode, set to false when publishing --> <constant name="struts.devMode" value="true" /> <!-- Set whether the class is hot loaded when it is modified, and set to false when publishing --> <constant name="struts.convention.classes.reload" value="true"/> <!-- Automatic dynamic method call, you can call it like this after using this setting: action!method --> <constant name="struts.enable.DynamicMethodInvocation" value="true" /> <!-- Specify the directory address where the jsp file is located--> <constant name="struts.convention.result.path" value="/WEB-INF/content/" /> <!-- Use the default converter of struts-default. If it is used for rest: rest-default, rest requires rest jar plugin--> <constant name="struts.convention.default.parent.package" value="struts-default"/> <!-- Used to configure package name suffix. Defaults are actions, actions, struts--> <constant name="struts.convention.package.locators" value="actions" /> <!-- Used to configure class name suffix, default is Action. After setting, Struts2 will only look for classes with this suffix name to map --> <constant name="struts.convention.action.suffix" value="Action"/> <!-- Settings creates Action map even if there is no @Action annotation. The default value is false. Because Convention-Plugin is a style that is better than configuration, you can access the methods in the corresponding Action based on the predefined definition without annotation--> <constant name="struts.convention.action.mapAllMatches" value="true"/> <!-- Custom jsp file name separator--> <constant name="struts.convention.action.name.separator" value="-" /> <!-- International resource file name--> <constant name="struts.custom.i18n.resources" value="i18n" /> <!-- Whether to automatically load international resource files--> <constant name="struts.i18n.reload" value="true" /> <!-- Whether the browser caches static content--> <constant name="struts.serve.static.browserCache" value="false" /> <!-- Upload file size limit settings--> <constant name="struts.multipart.maxSize" value="-1" /> <!-- Topic, set the value to simple, that is, do not use UI templates. This will not generate additional html tags --> <constant name="struts.ui.theme" value="simple" /> <!-- Encoding format --> <constant name="struts.i18n.encoding" value="UTF-8" /></struts>
Basic Constants
struts.devMode optional value is true, false (default false). In development mode, struts2's dynamic reload configuration and resource files will take effect by default. At the same time, more complete log support will be provided under the development mode.
struts.i18n.reload Optional value true, false (the default value depends on struts.devMode), whether the local resource file will be automatically reloaded.
struts.i18n.encoding is mainly used to set the analytical encoding of request encoding (default value (UTF-8)), Head and Include tags. Resolution encoding of resources and configuration files.
struts.configuration.xml.reload optional value true, false (the default value depends on struts.devMode) Whether to automatically reload the XML configuration file
struts.action.extension Sets the suffix of the action request of struts, separated by commas when multiple supports.
struts.action.excludePattern Sets the url excluded by struts (matched by regular expressions) (supports multiple, separated by commas)
struts.tag.altSyntax optional value true, false (default true) Whether or not the ognl expression is supported
struts.url.http.port Set the http port corresponding to the generated URL
struts.url.https.port Set the https port corresponding to the generated URL
struts.url.includeParams Optional value none, get, all (default get), sets whether the URL contains parameters and whether only parameters in GET mode are included.
struts.locale Sets the default locale of struts2 and decides which resource file to use.
struts.ui.templateDir This property specifies the location of the template file required for the view theme. The default value of this property is template, that is, the template file under the template path is loaded by default.
struts.ui.theme This property specifies the default view theme for the view tag, and the default value of this property is xhtml.
struts.ui.templateSuffix This property specifies the suffix of the template file, and the default property value of this property is ftl. This property also allows the use of ftl, vm or jsp, corresponding to FreeMarker, Velocity and JSP templates, respectively
struts.multipart.saveDir Sets the default directory for uploading temporary files
struts.multipart.maxSize Sets the maximum limit for uploaded temporary files
struts.objectFactory.spring.autoWire optional value (name, type, auto, constructor, name) (default name), sets the automatic assembly method of spring, which is only valid after the spring plug-in is introduced.
struts.objectFactory.spring.autoWire.alwaysRespect (default false) Sets whether objects are always created with the auto-assembly policy.
struts.objectFactory.spring.useClassCache (default false) Whether the object factory uses class cache, the development mode is invalid.
struts.xslt.nocache (default is false) Set whether XsltResult is not cached.
struts.custom.properties Sets the user's custom properties file name list (used by, separated)
struts.custom.i18n.resources Sets a user-defined resource file path list (used by, separated)
struts.serve.static (default false) Sets whether static resource requests are supported (requires url under struts or static)
struts.serve.static.browserCache (default false) Whether to set cache in static resource response. Only valid when static resources are supported.
struts.el.throwExceptionOnFailure (default false) Whether to throw a RuntimeException when parsing an el expression or a property cannot be found
struts.ognl.logMissingProperties (default false) Whether the log has no output found properties
struts.ognl.enableExpressionCache Whether to cache the expressions parsed by ognl.
struts.enable.DynamicMethodInvocation (default false) Whether dynamic method calls are supported, specify the method on the URL through !method.
struts.enable.SlashesInActionNames Whether slashes are supported in the Action segment in the URL
struts.mapper.alwaysSelectFullNamespace (default false) Whether the URL segment before the last slash is always used as the namespace
Core object Constants
struts.actionProxyFactory Sets the ActionProxy's entity factory, which also generates the default ActionInvoctation
struts.xworkConverter Sets the XWorkConverter object that is used to obtain various types of converters.
struts.unknownHandlerManager Sets the UnknownHandlerManager implementation class to handle exceptions such as the inability to find methods.
struts.multipart.handler Set the corresponding class of the handler of the multipartRequest (default is jakarta), org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest
struts.mapper.class Optional value (struts, composite, restful, restful2) sets the URL parsing and maps to ACTION implementation (default struts).
struts.mapper.prefixMapping maps to the corresponding mapper through the URL prefix, and the format is urlPrefix1:mapperName2, urlPrefix2:mapperName2. MapperClass must be added as org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper and specify struts.mapper.class as the mapper.
struts.mapper.composite Sets whether composite (multiple) actionMapper is supported, mappperName is separated by commas. Struts.mapper.class must be configured as composite to take effect
struts.mapper.idParameterName is used for Restful2ActionMapper as the parameterName corresponding to the id in the URL
struts.ognl.allowStaticMethodAccess (default false) Sets whether the ognl expression supports static methods.
struts.configuration Sets the Settings class of struts2. (Not used after 2.1.2)
struts.urlRenderer Sets the URL render of struts2 (used to generate URL), (default struts), class name org.apache.struts2.components.ServletUrlRenderer
struts.objectFactory Sets the object factory of struts2, the default is (struts), the class name is org.apache.struts2.impl.StrutsObjectFactory. After the struts2-spring plug-in is introduced, it is modified to org.apache.struts2.spring.StrutsSpringObjectFactory.
struts.xworkTextProvider Sets the implementation of the resource file content providing class for struts2. Default is com.opensymphony.xwork2.TextProviderSupport
struts.actionValidatorManager Sets the implementation class of ActionValidatorManager.
struts.valueStackFactory Sets the implementation of the ValueStack factory of struts2.
struts.reflectionProvider Sets the implementation class of ReflectionProvider
struts.reflectionContextFactory Sets the implementation class of ReflectionContextFactory
struts.patternMatcher Sets the implementation class of PatternMatcher
struts.staticContentLoader Sets the implementation class of StaticContentLoader