struts.properties的参数描述

时间:2023-03-09 18:20:46
struts.properties的参数描述
A.2.1  概述
如果我们希望覆盖在default.properties文件里面定义的默认配置,那就可以定义struts.properties文件,在里面设置我们需要的值,当然现在也可以在struts.xml中配置<constant>元素来实现同样的功能。
如果配置struts.properties文件,需要把它放置到当前的classpath下面,如果用Eclipse开发,把这个文件放到src下面就可以,会自动编译到classes下面。
struts.properties文件内的格式是“key=value”,一行一对的进行配置。
A.2.2 具体的参数描述
:struts.configuration
含义:用来指定一个用来读取默认配置的类,这个类需要继承org.apache.struts2.config.Configuration
默认值:org.apache.struts2.config.DefaultConfiguration
:struts.locale
含义:用来设置默认的locale
默认值:en_US
:struts.i18n.encoding
含义:用来设置默认的编码方式
默认值:UTF-
:struts.objectFactory
含义:用来设置默认的对象工厂
默认值:spring
:struts.objectFactory.spring.autoWire
含义:如果使用spring作为默认的对象工厂,这里就配置spring的自动装配策略
默认值:name
:struts.objectFactory.spring.useClassCache
含义:配置当struts和spring集成时,是否缓存类实例
默认值:true
:struts.objectFactory.spring.autoWire.alwaysRespect
含义:总是使用spring的自动装配策略
默认值:false
:struts.objectTypeDeterminer
含义:对象类型确定器。
默认值:tiger
:struts.multipart.parser
含义:指定进行multipart上传的解释器,也就是如何处理文件上传。
默认值:jakarta
:struts.multipart.saveDir
含义:指定进行multipart上传的临时文件存放路径。
默认值:没有指定
:struts.multipart.maxSize
含义:指定进行multipart上传的临时文件的最大限制。
默认值:
:struts.custom.properties
含义:用户自定义属性文件的路径,不能是struts.properties。
默认值:application,org/apache/struts2/extension/custom
:struts.mapper.class
含义:设置如何把url和类进行对应。
默认值:org.apache.struts2.dispatcher.mapper.DefaultActionMapper
:struts.action.extension
含义:指定需要Struts2处理的后缀列表,多个名字间用逗号分隔。
默认值:action,,
:struts.serve.static
含义:表示struts是否应该提供其jar文件内部的静态内容。
默认值:true
:struts.serve.static.browserCache
含义:是否缓存静态资源。
默认值:true
:struts.enable.DynamicMethodInvocation
含义:是否启用动态方法调用的功能。
默认值:true
:struts.enable.SlashesInActionNames
含义:是否可以在action的名称里面使用“/”。
默认值:false
:struts.tag.altSyntax
含义:是否可以使用“%{…}”格式的表达式。
默认值:true
:struts.devMode
含义:是否启用开发模式。
默认值:false
:struts.i18n.reload
含义:是否启用i18n自动重载。
默认值:false
:struts.ui.theme
含义:默认的主题
默认值:xhtml
:struts.ui.templateDir
含义:模板的默认存放路径
默认值:template
:struts.ui.templateSuffix
含义:模板的默认类型,可以是ftl(FreeMarker)、vm(Velocity)、jsp(JSP)
默认值:ftl
:struts.configuration.xml.reload
含义:指定是否在struts.xml文件被修改后重新加载它
默认值:false
:struts.velocity.configfile
含义:指定默认的Velocity配置文件
默认值:velocity.properties
:struts.velocity.contexts
含义:指定默认的Velocity Context的配置文件列表,用逗号分隔
默认值:没有指定
:struts.velocity.toolboxlocation
含义:指定Velocity工具箱的存放位置
默认值:没有指定
:struts.url.http.port
含义:指定默认的http端口号
默认值:
:struts.url.https.port
含义:指定默认的https端口号
默认值:
:struts.url.includeParams
含义:指定Struts 2生成URL时是否包含请求参数
默认值:none
:struts.custom.i18n.resources
含义:指定自定义的i18n资源包的名称
默认值:testmessages,testmessages2
:struts.dispatcher.parametersWorkaround
含义:指定为不支持HttpServlet Request调用getParameterMap()方法的应用程序提供其他方式的支持
默认值:false
:struts.freemarker.manager.classname
含义:指定使用哪一种FreeMarker Manager类。
默认值:org.apache.struts2.views.freemarker.FreemarkerManager
:struts.freemarker.templatesCache
含义:指定是否对FreeMarker的模板进行缓存。
默认值:false
:struts.freemarker.beanwrapperCache
含义:指定是否启用BeanWrapper的模型缓存。
默认值:false
:struts.freemarker.mru.max.strong.size
含义:指定Freemaker中MruCacheStorage的maxStrongSize。
默认值:
:struts.xslt.nocache
含义:是否使用样式表缓存。
默认值:false
:struts.mapper.alwaysSelectFullNamespace
含义:是否允许把最后一个反斜线之前的所有东西作为一个完整的命名空间。
默认值:false
:struts.ognl.allowStaticMethodAccess
含义:是否允许在OGNL表达式中访问静态方法。
默认值:false
:struts.el.throwExceptionOnFailure
含义:设置在处理el表达式的时候,是否可以抛出运行时错误。
默认值:false
:struts.ognl.logMissingProperties
含义:设置是否记录缺失属性日志。
默认值:false
:struts.ognl.enableExpressionCache
含义:设置设置是否缓存解析过的OGNL表达式。
默认值:true
<?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>
<!-- 本地化设置(默认浏览器语言) -->
<constant name="struts.locale" value="zh_CN" />
<!-- 国际化资源文件名称 -->
<constant name="struts.custom.i18n.resources" value="i18n" />
<!-- 是否自动加载国际化资源文件 -->
<constant name="struts.i18n.reload" value="true" />
<!-- 设置字符集,请求参数的编码方式 -->
<constant name="struts.i18n.encoding" value="UTF-8" />
<!-- 设置上传文件最大的字节数 -->
<constant name="struts.multipart.maxSize" value="1000000000" />
<!-- 设置浏览器是否使用浏览器缓存,开发环境建议为false -->
<constant name="struts.serve.static.browserCache" value="false" />
<!-- 设置使用struts的标签主题,开发环境建议用simple -->
<constant name="struts.ui.theme" value="simple" />
<!-- 设置使用struts的开发模式,开发环境建议为true -->
<constant name="struts.devMode" value="true"/>
<!-- 搜索视图资源的路径 -->
<constant name="struts.convention.result.path" value="/view/" />
<!-- Action类名分隔符 -->
<constant name="struts.convention.action.name.separator" value="_" />
<!-- convention类重加载 -->
<constant name="struts.convention.classes.reload" value="true" />
<!-- Action后缀名 -->
<constant name="struts.convention.action.suffix" value="Action" />
<!-- Action扩展名 -->
<constant name="struts.action.extension" value="action,do,html,htm,php,aspx" />
<!-- 搜索Action资源的包路径 -->
<constant name="struts.convention.package.locators" value="action,actions" />
</struts>