参考自:http://www.cnblogs.com/it563/articles/1939927.html
-
<?xml version="1.0" encoding="GBK"?>
-
<!-- 下面指定Struts 2.1配置文件的DTD信息 -->
- <!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
- "http://struts.apache.org/dtds/struts-2.1.dtd">
-
<!-- struts是Struts 2配置文件的根元素 -->
-
<struts>
- <!-- 下面元素可以出现零次,也可以出现无数次 -->
- <constant name="" value="" />
- <!-- 下面元素可以出现零次,也可以出现无数次 -->
- <bean type="" name="" class="" scope="" static="" optional="" />
- <!-- 下面元素可以出现零次,也可以出现无数次 -->
- <include file="" />
- <!-- package元素是Struts配置文件的核心,该元素可以出现零次,或者无数次 -->
- <package name="必填的包名" extends="" namespace="" abstract=""
- externalReferenceResolver>
- <!-- 该元素可以出现,也可以不出现,最多出现一次 -->
- <result-types>
- <!-- 该元素必须出现,可以出现无数次-->
- <result-type name="" class="" default="true|false">
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </result-type>
- </result-types>
- <!-- 该元素可以出现,也可以不出现,最多出现一次 -->
- <interceptors>
- <!-- 该元素的interceptor元素和interceptor-stack至少出现其中之一,
- 也可以二者都出现 -->
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <interceptor name="" class="">
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </interceptor>
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <interceptor-stack name="">
- <!-- 该元素必须出现,可以出现无数次-->
- <interceptor-ref name="">
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </interceptor-ref>
- </interceptor-stack>
- </interceptors>
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <default-interceptor-ref name="">
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>
- </default-interceptor-ref>
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <default-action-ref name="">
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </default-action-ref>?
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <global-results>
- <!-- 该元素必须出现,可以出现无数次-->
- <result name="" type="">
- <!-- 该字符串内容可以出现零次或多次 -->
- 映射资源
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </result>
- </global-results>
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <global-exception-mappings>
- <!-- 该元素必须出现,可以出现无数次-->
- <exception-mapping name="" exception="" result="">
- 异常处理资源
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </exception-mapping>
- </global-exception-mappings>
- <action name="" class="" method="" converter="">
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <result name="" type="">
- 映射资源
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </result>
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <interceptor-ref name="">
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </interceptor-ref>
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <exception-mapping name="" exception="" result="">
- 异常处理资源
- <!-- 下面元素可以出现零次,也可以无数次 -->
- <param name="参数名">参数值</param>*
- </exception-mapping>
- </action>
- </package>*
- <!-- unknown-handler-stack元素可出现零次或1次 -->
- <unknown-handler-stack>
- <!-- unknown-handler-ref元素可出现零次或多次 -->
- <unknown-handler-ref name=" ">...</unknown-handler-ref>*
- </unknown-handler-stack>?
-
<struts>
2)
struts.properties
文件
这个文件是struts2框架的全局属性文件,也是自动加载的文件。该文件包含了系列的key-value对。该文件完全可以配置在struts.xml文件中,使用constant元素。下面是这个文件中一些常见的配置项及说明。
-
### 指定加载struts2配置文件管理器,默认为org.apache.struts2.config.DefaultConfiguration
- ### 开发者可以自定义配置文件管理器,该类要实现Configuration接口,可以自动加载struts2配置文件。
- # struts.configuration=org.apache.struts2.config.DefaultConfiguration
-
- ### 设置默认的locale和字符编码
- # struts.locale=en_US
-
struts.i18n.encoding=UTF-8
-
-
- ### 指定struts的工厂类
- # struts.objectFactory = spring
-
- ### 指定spring框架的装配模式
- ### 装配方式有: name, type, auto, and constructor (name 是默认装配模式)
-
struts.objectFactory.spring.autoWire = name
-
- ### 该属性指定整合spring时,是否对bean进行缓存,值为true or false,默认为true.
-
struts.objectFactory.spring.useClassCache = true
-
- ### 指定类型检查
- #struts.objectTypeDeterminer = tiger
- #struts.objectTypeDeterminer = notiger
-
- ### 该属性指定处理 MIME-type multipart/form-data,文件上传
- # struts.multipart.parser=cos
- # struts.multipart.parser=pell
-
struts.multipart.parser=jakarta
- # 指定上传文件时的临时目录,默认使用 javax.servlet.context.tempdir
-
strutsstruts.multipart.saveDir=
- struts.multipart.maxSize=2097152
-
- ### 加载自定义属性文件 (不要改写struts.properties!)
- # struts.custom.properties=application,org/apache/struts2/extension/custom
-
- ### 指定请求url与action映射器,默认为org.apache.struts2.dispatcher.mapper.DefaultActionMapper
- #struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
-
- ### 指定action的后缀,默认为action
-
struts.action.extension=action
-
- ### 被 FilterDispatcher使用
- ### 如果为 true 则通过jar文件提供静态内容服务.
- ### 如果为 false 则静态内容必须位于 <context_path>/struts
-
struts.serve.static=true
-
- ### 被 FilterDispatcher使用
- ### 指定浏览器是否缓存静态内容,测试阶段设置为false,发布阶段设置为true.
-
struts.serve.static.browserCache=true
-
- ### 设置是否支持动态方法调用,true为支持,false不支持.
-
struts.enable.DynamicMethodInvocation = true
-
- ### 设置是否可以在action中使用斜线,默认为false不可以,想使用需设置为true.
-
struts.enable.SlashesInActionNames = false
-
- ### 是否允许使用表达式语法,默认为true.
-
struts.tag.altSyntax=true
-
-
- ### 设置当struts.xml文件改动时,是否重新加载.
- ### - struts.configuration.xml.reload = true
- ### 设置struts是否为开发模式,默认为false,测试阶段一般设为true.
-
struts.devMode = false
-
- ### 设置是否每次请求,都重新加载资源文件,默认值为false.
-
struts.i18n.reload=false
-
- ###标准的UI主题
- ### 默认的UI主题为xhtml,可以为simple,xhtml或ajax
-
struts.ui.theme=xhtml
- ###模板目录
-
struts.ui.templateDir=template
- #设置模板类型. 可以为 ftl, vm, or jsp
-
struts.ui.templateSuffix=ftl
-
- ###定位velocity.properties 文件. 默认 velocity.properties
-
struts.velocity.configfile = velocity.properties
-
- ### 设置velocity的context.
-
struts.velocity.contexts =
-
- ### 定位toolbox.
-
struts.velocity.toolboxlocation=
-
- ### 指定web应用的端口.
-
struts.url.http.port = 80
- ### 指定加密端口
-
struts.url.https.port = 443
- ### 设置生成url时,是否包含参数.值可以为: none, get or all
-
struts.url.includeParams = get
-
- ### 设置要加载的国际化资源文件,以逗号分隔.
- # struts.custom.i18n.resources=testmessages,testmessages2
-
- ### 对于一些web应用服务器不能处理HttpServletRequest.getParameterMap()
- ### 像 WebLogic, Orion, and OC4J等,须设置成true,默认为false.
-
struts.dispatcher.parametersWorkaround = false
-
- ### 指定freemarker管理器
- #struts.freemarker.manager.classname=org.apache.struts2.views.freemarker.FreemarkerManager
-
- ### 设置是否对freemarker的模板设置缓存
- ### 效果相当于把template拷贝到 WEB_APP/templates.
-
struts.freemarker.templatesCache=false
-
- ### 通常不需要修改此属性.
-
struts.freemarker.wrapper.altMap=true
-
- ### 指定xslt result是否使用样式表缓存.开发阶段设为true,发布阶段设为false.
-
struts.xslt.nocache=false
-
- ### 设置struts自动加载的文件列表.
-
strutsstruts.configuration.files=struts-default.xml,struts-plugin.xml,struts.xml
-
- ### 设定是否一直在最后一个slash之前的任何位置选定namespace.
-
struts.mapper.alwaysSelectFullNamespace=false
分享到:
相关推荐
struts.xml文件详解.docstruts.xml文件详解.docstruts.xml文件详解.docstruts.xml文件详解.doc
struts.xml文件详解示例代码,可以参照http://blog.csdn.net/jiajia333666/article/details/47979919 阅读。
struts.xml配置文件详解struts.xml配置文件详解struts.xml配置文件详解
NULL 博文链接:https://wellfrog.iteye.com/blog/612014
绝对的好东西 struts2.0中struts.xml配置文件详解
struts.xml详解.docstruts.xml详解.docstruts.xml详解.doc
struts.xml是我们在开发中利用率最高的文件,也是Struts2中最重要的配置文件。
struts2.0中struts.xml配置文件详解
Struts-config.xml配置详解,介绍Struts-config中8个元素配置方法。
韩顺平视频配套struts-config.xml配置详解.txt
详细介绍struts.xml的属性配置,希望能帮助到各位,不足的地方请各位指教!
struts.xml详解[整理].pdf
Struts-config.xml 配置详解.doc Struts-config.xml 配置详解.doc
struts1 web.xml struts1配置
struts-config.xml 详解struts-config.xml 详解
struts-config.xml 文件详解 以下是一份完整的struts-config.xml文件,配置元素的说明详见注释.
struts配置文件讲解。。。。。。。。。。。。。。。。。。。。。
struts-config.xml配置文件详解
配置 struts-config.xml 元素 属性的详解!转载来的,,看着很好!》希望对大家有用!