Original address :http://blog.csdn.net/wfcaven/article/details/5937567

Struts2 Provides many configurable properties , By setting these properties , You can change the behavior of the framework , So as to satisfy different Web Application requirements . These properties can be found in Struts.properties Set this in the file ,struts.properties It's standard Java Property file format ,"#" As a comment character , The file is controlled by the key (Key)- value (value) The composition of ,struts2 The property of is key , The value of the property is the value .

struts.properties The file must be located in classpath Next , Usually placed in Web Application's /WEB-INF/classes Under the table of contents .

struts2 stay default.properties file ( be located struts2-core-2.0.11.jar Medium org/apache/struts2 Under the table of contents ) A list of all the attributes is given in , And set default values for some of these properties . If you create struts.properties file , Then the property settings in the file will override default.properties Property settings in the file .

default.properties The attributes given in the file and their functions are as follows :

struts.configuration

Specified for configuration Struts2 Of Configuration The implementation class of the excuse , The default is com.opensymphony.xwork2.config.impl.DefaultConfiguration class . You can achieve com.opensymphony.xwork2.config.Configuration Interface , Then get the configuration parameters in your own way and pass them to Struts2. This property is not set .

struts.locale

Specify the default locale. This property is not set .

struts.i18n.encoding

Specify the default encoding scheme , The default value is UTF-8, When solving the problem of Chinese garbled code , Try setting it to GBK or GB2312.

struts.objectFactory

Specifying this property can override the default object factory . To provide a custom implementation , Need from com.opensymphony.xwork2.ObjectFactory Class inheritance , And specify the subclass name for the modified property . The idea is , Changing the value of a property also supports abbreviations in some cases , for example "spring". This property is not set .

struts.objectFactory.spring.autoWire

Specify when using SpringObjectFactory Automatic assembly of logic . Valid values include :name、type、auto and constructor, The default value is name.

struts.objectFactory.spring.useClassCache

Specified in the Strut2 Framework for the integration Spring when ,Spring Whether instances of classes should be cached . Valid values include trut and false, The default value is true. In general, it is not recommended to modify the value of this property .

struts.objectTypeDeterminer

Specify the object type detection mechanism . By default com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer class , He uses generics to handle type checking . As a substitute , You can have the same com.opensymphony.xwork2.util.ObjectTypeDeterminer The implementation class of the excuse , And specify the class name of the implementation class for the modified property . The idea is , Changing the value of a property can also be abbreviated , Valid values include :tiger and notiger. If you want to shut down tiger Support , Use notiger Property value . This property is not set .

struts.multipart.parser

Specify treatment HTTP POST The parser for the request , The request uses MIME type multipart/form-data Encoding . This attribute is mainly used to support file upload , The optional value is pell、cos and jakarta, The default value is jakarta, That is to use ASF Of commons-fileupload Component handles file upload .

struts.multipart.saveDir

Specify the temporary directory for file upload . By default javax.servlet.context.tempdir.

struts.multipart.maxSize

Specifies the maximum number of bytes of files allowed to be uploaded . The default value is 2097152.

struts.custom.properties

Specifies the list of user-defined property files to load ( Separated by commas ), The property settings in these property files do not override struts.properties Property settings in the file . This property is not set .

struts.mapper.class

Appoint org.apache.struts2.dispatcher.ActionMapper Implementation class of interface , Used for processing HTTP Request and action Mapping between . This property is not set .

struts.action.extension

Appoint struts2 The suffix of the request processed , The default value is action, All matches *.action All requests are made by struts2 Handle . You can specify multiple suffixes , The suffixes are separated by commas , for example :struts.action.extension=do,asp,aspx,php.

struts.serve.static

Change attribute by FilterDispatcher Use . The optional value is true and false, The default value is true. If true, that Struts2 Will be for him jar The static content in the package provides if ; If false, So static content has to be in <context_path>/struts You can only visit .

struts.serve.static.browserCache

Specifies whether the browser caches static content . The optional value is true and false, The default value is true. Be careful , The only way to change attributes is struts.serve.static=true It works when . In the development stage , If we want the change of static content to be reflected in every request , You can set this property to false.

struts.enable.DynamicMethodInvocation

Set up struts2 Whether dynamic method calls are supported . The optional value is true and false, The default is ture.

struts.enable.SlashesInActionNames

Designated as action When the name , Whether slashes are allowed in names . The optional value is true and false, The default is false.

struts.tag.altSyntax=true

Specified in the struts2 Whether to use "%{}" To evaluate the expression in the string property of a label . The optional value is true and false, The default value is true.

struts.devMode

Specifies whether to use development mode . The optional value is true and false, The default value is false. When set to true when ,struts2 Will be more developer friendly , This includes :

1)struts.i18n.reload = true

2)struts.configuraion.xml.reload = true

3) Report various debugging or negligible problems as errors

struts.i18n.reload=false

Specifies whether resource packages are automatically reloaded on each request .

struts.ui.theme

Set up struts2 Of UI The default theme of the tag is . Change the default value of the property to xhtml.

struts.ui.templateDir

Appoint UI Label template file directory . Change the default value of the property to template.

struts.ui.templateSuffix = ftl

Set the default template type , It can be ftl、vm perhaps jsp. Change the default value of the property to ftl.

struts.configuration.xml.reload = false

Specifies when the configuration file (struts.xml) Whether to reload it when changing . The default value is false.

struts.velocity.configfile=velocity.properties

Appoint velocity The location of the configuration file . Change the default value of the property to velocity.properties.

struts.velocity.contexts

Appoint velocityContext The name of the class , If there are multiple classes , Separated by commas . These classes are linked to the StrutsVelocityContext.

struts.velocity.toolboxlocation

Appoint velocitytoolbox The location of .

struts.url.http.port

Designated for url Labeled HTTP port .url Tags are generated by changing the port URL. Change the default value of the property to 80.

struts.url.https.port

Designated for url Labeled HTTPS port . The default value of the modified attribute is 443.

struts.url.includeParams

Appoint url Tag generation URL Whether the request parameter is included in the , The optional value is :none、get and all, It means that it does not contain 、 Contains only get Request parameters and include all request parameters . The default value is get.

struts.custom.i18n.resources=testmessages,testmessages2

Specifies the base name of the internationalized resource package to load , If there are multiple bags , Separated by commas . Change property not set .

struts.dispatcher.parametersWorkaround

Some application servers do not support HttpServletRequest Of getParameterMap() Method call , for example WebLogic、Orion and OC4J, You can set this property to true. The default value is false.

struts.freemarker.manager.classname

Configure the freemarker Manager class . Changing properties allows users to insert custom freemarker Manager , The manager has to extend org.apache.struts2.views.freemarker.FreemakerManager class . This property is not set .

struts.freemarker.templatesCache

Specifies whether to cache FreeMarker Template . The default value is false.

struts.freemarker.wrapper.altMap

StrutsBeanWrapper Yes FreeMarker Of BeansWrapper stay Map Some improvements have been made in the handling of types , If you want to use normal BeansWrapper Logic , Set the change property to false, The default value is true.

struts.xslt.nocache

To configure XSLTResult Whether to use style sheet caching .

struts.configuration.files

Appoint struts2 List of configuration files automatically loaded by default , Separated by commas . The default value is struts-default,xmlstruts-plugin,xmlstruts.xml.

struts.mapper.alwaysSelectFullNamespace

Set whether the mapper always selects the full namespace , The default value is false.

Struts.properties( turn ) More articles about

  1. struts.properties Configuration details

    Struts 2 The framework has two core profiles , among struts.xml The document is mainly responsible for the management of Action mapping , And it's time to Action Contains Result Definition, etc . besides ,Struts 2 The framework also contains      st ...

  2. struts.properties Parameter description of

    A.2.1 summary If we want to cover default.properties The default configuration defined in the file , That would define struts.properties file , Set the values we need inside , Of course, it can also be in struts ...

  3. Struts2 Configuration Struts.properties

    Struts 2 The framework has two core profiles , among struts.xml The document is mainly responsible for the management of Action mapping , And it's time to Action Contains Result Definition, etc . In addition to this Outside ,Struts 2 The framework also contains      s ...

  4. struts.properties Configuration details ( turn )

    Struts 2 The framework has two core profiles , among struts.xml The document is mainly responsible for the management of Action mapping , And it's time to Action Contains Result Definition, etc . In addition to this Outside ,Struts 2 The framework also contains      s ...

  5. Struts2 Of struts.properties Where are the documents ?

    The teacher taught us Struts2 We were told to build a Struts.xml Documents ? that struts.properties Well ? Don't you need ? answer 1: struts.properties It can't be !!! because stru ...

  6. Struts2 In the relevant struts-default.xml,struts.xml,struts.properties File,

    1) struts-default.xml This file is struts2 The default configuration file loaded by the framework . It defines struts2 Some of the core bean And interceptors . <?xml version="1.0&qu ...

  7. struts2:struts.properties Configuration file introduction and constant loading order

    1. background struts2 There are two core profiles in the framework , among struts.xml The document is mainly responsible for the management of action mapping , And it's time to action Contains result Definition, etc . besides ,struts2 The framework also includes a ...

  8. struts2 Set a path that is not the default struts.properties as well as .properties File solutions

    One .web Applied classpath brief introduction    classpath The path is in each J2ee It's used in every project , namely WEB-INF Below classes Catalog , all src Under directory java.xml.properties etc. ...

  9. struts.properties file

    This profile provides a mechanism to change the default behavior of the framework . In fact, all struts.propertiesconfiguration The properties contained in the file can also be configured in web.xml Used in init-param, And in st ...

Random recommendation

  1. js Get the width and height of the element

    You can use Yuansheng js Of .offsetHeight .offsetWidth attribute document.getElementById("temp_form").offsetHeight // ...

  2. KVO Key value observer

    KVO( Key value observer ) // The creation of listening -(id)initChildren:(Person *)person { self = [super init]; if (self != nil) { // Have ...

  3. ASP.NET MVC Improved version of paging implementation - Adding the same view can set multiple pagination

    I've done it before ASP.NET MVC Pagination ( Check out this post ), But it has limitations , You have to make sure that there is only one page in the same view , If you need to set multiple pagination in the same view , But there's nothing we can do , So , I optimized the original code again , Added ...

  4. ThinkPHP Of CURD

    1.ThinkPHP 3 Reading data ( a key ) Reading data Read $m=new Model('User'); $m=M('User'); select $arr = $m->select() ...

  5. python Automated test applications - The first 6 piece (WEB test )--Selenium Elements

    piece 6                            python Automated test applications -Selenium The basic chapter --lamecho 1.1 Summary Hello everyone ! I am a lamecho( Hot and ugly ), Last time we set up p ...

  6. SpringBoot Use prometheus monitor

    In this paper, SpringBoot How to use Prometheus coordination Grafana monitor . 1. About Prometheus Prometheus It's an application based metrics Open source tools for monitoring . I believe a lot of projects are ...

  7. Using the directory function (opendir,readdir,closedir) Find the number of files

    How to know the number of all files in a directory ? Maybe we can use tree To learn (zhuang) xi (bi) At the same time know the number of files .Linux System io Function provides us with a directory operation function , One of them is more important ( There are actually three , Because they often go with ...

  8. Java Generating uniqueness GUID

    GUID(Global unique identifier) Globally unique identifier , It is determined by the identification number on the network card ( Each network card has a unique identification number ) as well as CPU The only number generated by the clock 16 The binary value of a byte . GUID ...

  9. lua if Process control

    Lua Think false and nil For false ,true He Fei nil It's true . It should be noted that Lua in 0 by true --[ by true ] ) then print("0 by true") end ...

  10. AgentJob-- Modify the operating system time to Job Influence

    scene : There is a database job per 10 Run every minute , After the system administrator changes the operating system time , The job has not run for a long time . analysis : The last time the job was run was 10:20, According to the assignment plan , The next run time is 10:30, And the system administrator changes ...