The Struts 2 framework has two core configuration files, where the Struts.xml file is primarily responsible for managing the action mappings in the app, as well as the result definitions that the action contains. In addition to this, the Struts 2 framework also contains the Struts.properties file, which defines a number of properties for the Struts 2 framework that developers can adapt to meet the needs of the application.
The Struts.properties file is a standard properties file that contains a series of Key-value objects, each of which is a Struts 2 property, and the key corresponding to value is a Struts 2 property.
Struts.properties files are usually placed under the web-inf/classes path of the Web application. In fact, the Struts 2 framework can load the file as long as it is placed under the Classpath path of the Web App.
Now the question is, which key of the Struts.properties file is valid? That is, the Struts.properties file contains properties that are valid for Struts 2. The following is a list of the Struts 2 properties that you can define in Struts.properties.
struts.configuration: This property specifies the configuration file manager that loads the Struts 2 profile. The default value for this property is Org.apache.Struts2.config.DefaultConfiguration, which is the default Profile Manager for Struts 2. If you need to implement your own Configuration Manager, developers can implement a class that implements a configuration interface that can load the Struts 2 configuration file on its own.
Struts.locale: Specifies the default locale for the Web app.
struts.i18n.encoding: Specifies the default encoding set for the Web App. This property is useful for handling Chinese request parameters and should be set to GBK or GB2312 for the Chinese request parameter value.
Tip When you set this parameter to GBK, it is equivalent to calling HttpServletRequest's Setcharacterencoding method. String 5
struts.objectfactory: Specifies the default objectfactory Bean for Struts 2, which is the default value of spring.
Struts.objectFactory.spring.autoWire: Specifies the auto-assembly mode of the spring framework, which defaults to name, which is automatically assembled by default based on the bean's Name property.
Struts.objectFactory.spring.useClassCache: This property specifies whether a bean instance is cached when the spring framework is consolidated, which allows only true and false two property values. Its default value is true. Modifying this property value is not generally recommended.
Struts.objecttypedeterminer: This property specifies the type detection mechanism for Struts 2, which typically supports Tiger and notiger two attribute values.
Struts.multipart.parser: This property specifies the framework that handles the MIME type (file upload) request of Multipart/form-data, which supports attribute values such as COS, Pell, and Jakarta, which are corresponding to the file upload frame using COS, pell upload and common-fileupload file upload frame respectively. The default value for this property is Jakarta.
Note If you need to use the COS or Pell file Upload method, you should copy the corresponding jar file to the Web App. For example, using the Cos upload method, you need to download the jar file for the COS framework yourself and place the file under the Web-inf/lib path.
Struts.multipart.saveDir: This property specifies the temporary save path for the uploaded file, and the default value for this property is Javax.servlet.context.tempdir.
struts.multipart.maxSize: This property specifies the maximum number of bytes allowed for the entire request content on a Struts 2 file.
Character struts.custom.properties: This property specifies that the Struts 2 app loads a user-defined property file that specifies a property that does not overwrite the property 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 commas (,).
String 2
Struts.mapper.class: Specifies the mapper that maps the HTTP request to the specified action, struts 2 The default mapper is provided: Org.apache.struts2.dispatcher.mapper.DefaultActionMapper. The default mapper completes the mapping based on the prefix of the request with the Name property of the action. String 1
struts.action.extension: This property specifies the request suffix that needs to be processed by Struts 2, the default value of which is action, that is, all requests that match *.action are handled by struts 2. If the user needs to specify multiple request suffixes, the multiple suffixes are separated by commas (,).
struts.serve.static: This property sets whether to provide a static content service through a jar file that only supports the true and false property values, which are true for the default property value.
Struts.serve.static.browserCache: This property sets whether the browser caches static content. When the app is in development, we want each request to get the latest response from the server, you can set the property to False. String 9
struts.enable.DynamicMethodInvocation: 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.
struts.enable.SlashesInActionNames: This property sets whether struts 2 is allowed to use a slash in the action name, and the default value of this property is false. This property can be set to true if the developer wants to allow a slash in the action name.
Struts.tag.altSyntax: This property specifies whether expression syntax is allowed in the Struts 2 label, because the expression syntax is usually required in the label, so the property should be set to true, and the default value of this property is true.
Struts.devmode: This property sets whether the Struts 2 app uses development mode. If you set this property to True, you can display more and more friendly error hints when an error is applied. This property accepts only true and flase two values, and the default value for this property is false. Typically, the app is set to true during development, and is set to False when the product release phase is entered.
struts.i18n.reload: This property sets whether the system reloads the resource file every time the HTTP request arrives. The default value of this property is false. Setting this property to true during development is more beneficial for development, but should be set to false during the product release phase. String 4
Tip The development phase sets this property to true and will reload the internationalized resource file on each request, allowing developers to see real-time development effects, which should be set to false in the product release phase to provide response performance. Reloading the resource file for each request can greatly reduce the performance of the application.
Struts.ui.theme: This property specifies the default view theme for the view label, which is the default value of XHTML.
Struts.ui.templateDir: This property specifies the location of the template file that is required for the view theme, which is the default value of the template, which is the templates file under the default load-path.
Struts.ui.templateSuffix: This property specifies the suffix of the template file, and the default property value for this property is FTL. This property also allows the use of FTL, VMS, or JSPs to correspond to freemarker, velocity, and JSP templates, respectively.
struts.configuration.xml.reload: This property sets whether the system reloads the file automatically when the Struts.xml file changes. The default value for this property is false.
struts.velocity.configfile: This property specifies the location of the Velocity.properties file required by the velocity framework. The default value for this property is velocity.properties.
struts.velocity.contexts: This property specifies the context position of the velocity frame, and if the frame has more than one context, the multiple context is separated by a comma (,).
struts.velocity.toolboxlocation: This property specifies the location of the toolbox for the velocity frame.
Struts.url.http.port: This property specifies the listening port on which the Web app resides. This property is typically not too large for users, but it only provides the default port for Web apps when struts 2 needs to generate a URL, such as a URL tag.
Struts.url.https.port: This property is similar to the role of the Struts.url.http.port property, except that the property specifies the cryptographic service port for the Web App.
struts.url.includeParams: This property specifies whether the request parameters are included when Struts 2 generates the URL. This property accepts none, get, and all three property values, respectively, corresponding to a request parameter that does not contain, contains only a get type, and contains all the request parameters.
struts.custom.i18n.resources: This attribute specifies the Internationalized resource files required by the Struts 2 application, and if there are multiple internationalized resource files, the file names of multiple resource files are separated by commas (,).
Struts.dispatcher.parametersWorkaround: For some Java EE servers, the HttpServlet request call Getparametermap () method is not supported. You can set the property value to True to resolve the problem. The default value for this property is false. For WebLogic, Orion, and OC4J servers, this property should normally be set to true.
Struts.freemarker.manager.classname: 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.
Struts.freemarker.wrapper.altMap: This property supports only true and false two property values, and the default value is true. You typically do not need to modify this property value.
Struts.xslt.nocache: This property specifies whether the XSLT result uses the style sheet cache. This property is usually set to True when the app is in development, and is usually set to False when the app is in the product usage phase.
struts.configuration.files: This property specifies the configuration file that the Struts 2 framework loads by default, and if you need to specify that multiple configuration files are loaded by default, separate the file names of multiple profiles with commas (,). The default value for this property is Struts-default.xml,struts-plugin.xml,struts.xml, and when you see the property value, the reader should understand why the Struts 2 framework loads the Struts.xml file by default.
The Struts 2 framework has two core configuration files, where the Struts.xml file is primarily responsible for managing the action mappings in the app, as well as the result definitions that the action contains. In addition to this, the Struts 2 framework also contains the Struts.properties file, which defines a number of properties for the Struts 2 framework that developers can adapt to meet the needs of the application.
The Struts.properties file is a standard properties file that contains a series of Key-value objects, each of which is a Struts 2 property, and the key corresponding to value is a Struts 2 property.
Struts.properties files are usually placed under the web-inf/classes path of the Web application. In fact, the Struts 2 framework can load the file as long as it is placed under the Classpath path of the Web App.
Now the question is, which key of the Struts.properties file is valid? That is, the Struts.properties file contains properties that are valid for Struts 2. The following is a list of the Struts 2 properties that you can define in Struts.properties.
struts.configuration: This property specifies the configuration file manager that loads the Struts 2 profile. The default value for this property is Org.apache.Struts2.config.DefaultConfiguration, which is the default Profile Manager for Struts 2. If you need to implement your own Configuration Manager, developers can implement a class that implements a configuration interface that can load the Struts 2 configuration file on its own.
Struts.locale: Specifies the default locale for the Web app.
struts.i18n.encoding: Specifies the default encoding set for the Web App. This property is useful for handling Chinese request parameters and should be set to GBK or GB2312 for the Chinese request parameter value.
Tip When you set this parameter to GBK, it is equivalent to calling HttpServletRequest's Setcharacterencoding method. String 5
struts.objectfactory: Specifies the default objectfactory Bean for Struts 2, which is the default value of spring.
Struts.objectFactory.spring.autoWire: Specifies the auto-assembly mode of the spring framework, which defaults to name, which is automatically assembled by default based on the bean's Name property.
Struts.objectFactory.spring.useClassCache: This property specifies whether a bean instance is cached when the spring framework is consolidated, which allows only true and false two property values. Its default value is true. Modifying this property value is not generally recommended.
Struts.objecttypedeterminer: This property specifies the type detection mechanism for Struts 2, which typically supports Tiger and notiger two attribute values.
Struts.multipart.parser: This property specifies the framework that handles the MIME type (file upload) request of Multipart/form-data, which supports attribute values such as COS, Pell, and Jakarta, which are corresponding to the file upload frame using COS, pell upload and common-fileupload file upload frame respectively. The default value for this property is Jakarta.
Note If you need to use the COS or Pell file Upload method, you should copy the corresponding jar file to the Web App. For example, using the Cos upload method, you need to download the jar file for the COS framework yourself and place the file under the Web-inf/lib path.
Struts.multipart.saveDir: This property specifies the temporary save path for the uploaded file, and the default value for this property is Javax.servlet.context.tempdir.
struts.multipart.maxSize: This property specifies the maximum number of bytes allowed for the entire request content on a Struts 2 file.
struts.custom.properties: This property specifies that the Struts 2 app loads a user-defined property file that specifies a property that does not overwrite the property 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 commas (,).
String 2
Struts.mapper.class: Specifies the mapper that maps the HTTP request to the specified action, struts 2 The default mapper is provided: Org.apache.struts2.dispatcher.mapper.DefaultActionMapper. The default mapper completes the mapping based on the prefix of the request with the Name property of the action. String 1
struts.action.extension: This property specifies the request suffix that needs to be processed by Struts 2, the default value of which is action, that is, all requests that match *.action are handled by struts 2. If the user needs to specify multiple request suffixes, the multiple suffixes are separated by commas (,).
struts.serve.static: This property sets whether to provide a static content service through a jar file that only supports the true and false property values, which are true for the default property value.
Struts.serve.static.browserCache: This property sets whether the browser caches static content. When the app is in development, we want each request to get the latest response from the server, you can set the property to False. String 9
struts.enable.DynamicMethodInvocation: 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.
struts.enable.SlashesInActionNames: This property sets whether struts 2 is allowed to use a slash in the action name, and the default value of this property is false. This property can be set to true if the developer wants to allow a slash in the action name.
Struts.tag.altSyntax: This property specifies whether expression syntax is allowed in the Struts 2 label, because the expression syntax is usually required in the label, so the property should be set to true, and the default value of this property is true.
Struts.devmode: This property sets whether the Struts 2 app uses development mode. If you set this property to True, you can display more and more friendly error hints when an error is applied. This property accepts only true and flase two values, and the default value for this property is false. Typically, the app is set to true during development, and is set to False when the product release phase is entered.
struts.i18n.reload: This property sets whether the system reloads the resource file every time the HTTP request arrives. The default value of this property is false. Setting this property to true during development is more beneficial for development, but should be set to false during the product release phase. String 4
Tip The development phase sets this property to true and will reload the internationalized resource file on each request, allowing developers to see real-time development effects, which should be set to false in the product release phase to provide response performance. Reloading the resource file for each request can greatly reduce the performance of the application.
Struts.ui.theme: This property specifies the default view theme for the view label, which is the default value of XHTML.
Struts.ui.templateDir: This property specifies the location of the template file that is required for the view theme, which is the default value of the template, which is the templates file under the default load-path.
Struts.ui.templateSuffix: This property specifies the suffix of the template file, and the default property value for this property is FTL. This property also allows the use of FTL, VMS, or JSPs to correspond to freemarker, velocity, and JSP templates, respectively.
struts.configuration.xml.reload: This property sets whether the system reloads the file automatically when the Struts.xml file changes. The default value for this property is false.
struts.velocity.configfile: This property specifies the location of the Velocity.properties file required by the velocity framework. The default value for this property is velocity.properties.
struts.velocity.contexts: This property specifies the context position of the velocity frame, and if the frame has more than one context, the multiple context is separated by a comma (,).
struts.velocity.toolboxlocation: This property specifies the location of the toolbox for the velocity frame.
Struts.url.http.port: This property specifies the listening port on which the Web app resides. This property is typically not too large for users, but it only provides the default port for Web apps when struts 2 needs to generate a URL, such as a URL tag.
Struts.url.https.port: This property is similar to the role of the Struts.url.http.port property, except that the property specifies the cryptographic service port for the Web App.
struts.url.includeParams: This property specifies whether the request parameters are included when Struts 2 generates the URL. This property accepts none, get, and all three property values, respectively, corresponding to a request parameter that does not contain, contains only a get type, and contains all the request parameters.
struts.custom.i18n.resources: This attribute specifies the Internationalized resource files required by the Struts 2 application, and if there are multiple internationalized resource files, the file names of multiple resource files are separated by commas (,).
Struts.dispatcher.parametersWorkaround: For some Java EE servers, the HttpServlet request call Getparametermap () method is not supported. You can set the property value to True to resolve the problem. The default value for this property is false. For WebLogic, Orion, and OC4J servers, this property should normally be set to true.
struts.freemarker.manager.classname: 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.
Struts.freemarker.wrapper.altMap: This property supports only true and false two property values, and the default value is true. You typically do not need to modify this property value.
String 5
Struts.xslt.nocache: This property specifies whether the XSLT result uses the style sheet cache. This property is usually set to True when the app is in development, and is usually set to False when the app is in the product usage phase.
struts.configuration.files: This property specifies the configuration file that the Struts 2 framework loads by default, and if you need to specify that multiple configuration files are loaded by default, separate the file names of multiple profiles with commas (,). The default value for this property is Struts-default.xml,struts-plugin.xml,struts.xml, and when you see the property value, the reader should understand why the Struts 2 framework loads the Struts.xml file by default
Struts.properties configuration details (RPM)