Struts 2 XML文件通配符 只需要配…
2013-12-20 12:55
363 查看
struts.xml 文件配置
<?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.custom.i18n.resources" value="custom"
/> <constant name="struts.locale"
value="zh_CN" /> <constant
name="struts.i18n.encoding" value="UTF-8" />
<constant name="struts.devMode" value="false"
/> <include file="struts-default.xml"
/> <constant
name="struts.objectFactory" value="spring" />
<constant name="struts.devMode" value="false"
/> <constant name="struts.locale"
value="zh_CN" /> <constant
name="struts.multipart.maxSize" value="10000000000000"
/> <constant
name="struts.custom.i18n.resources"
value="messageResource"/> <constant
name="struts.i18n.encoding" value="UTF-8"/>
<package name="cn.struts"
extends="struts-default"> <!-- Level
cn/struts/LevelAction_aa.action 调用LevelAction类
的aa方法--> <action name="*_*"
class="{1}" method="{2}"> <!-- chain
用来处理Action链 com.opensymphony.xwork2.ActionChainResult
--> <result name="chain"
type="chain">${successResultValue}</result>
<!-- dispatcher 用来转向页面,通常处理JSP
org.apache.struts2.dispatcher.ServletDispatcherResult
--> <result
name="dispatcher">${successResultValue}</result>
<!-- httpheader 控制特殊HTTP行为的结果类型
org.apache.struts2.dispatcher.HttpHeaderResult -->
<result name="httpheader"
type="httpheader">${successResultValue}</result>
<!-- redirect 重定向到一个URL
org.apache.struts2.dispatcher.ServletRedirectResult
--> <result name="redirect"
type="redirect">${successResultValue}</result>
<!-- redirectAction 重定向到一个Action
org.apache.struts2.dispatcher.ServletActionRedirectResult
--> <result name="redirectAction"
type="redirectAction">${successResultValue}</result>
<!-- stream
向浏览器发送InputSream对象,通常用来处理文件下载,还可用于返回AJAX数据
org.apache.struts2.dispatcher.StreamResult -->
<result name="stream"
type="stream">${successResultValue}</result>
<!-- velocity 处理Velocity模板
org.apache.struts2.dispatcher.VelocityResult -->
<result name="velocity"
type="velocity">${successResultValue}</result>
<!-- xslt 处理XML/XLST模板
org.apache.struts2.views.xslt.XSLTResult -->
<result name="xslt"
type="xslt">${successResultValue}</result>
<!-- plainText 显示原始文件内容,例如文件源代码
org.apache.struts2.dispatcher.PlainTextResult -->
<result name="plainText"
type="plainText">${successResultValue}</result>
<!-- redirect-action 重定向到一个Action
org.apache.struts2.dispatcher.ServletActionRedirectResult
<result name="redirect-action"
type="redirect-action">${successResultValue}</result>-->
<!-- plaintext 显示原始文件内容,例如文件源代码
org.apache.struts2.dispatcher.PlainTextResult
<result name="plaintext"
type="plaintext">${successResultValue}</result>
--> <!-- freemaker 处理FreeMarker模板
org.apache.struts2.views.freemarker.FreemarkerResult
<result name="freemarker"
type="freemarker">${successResultValue}</result>
--> </action>
</package> <!--
<include
file="struts2.xml"></include>
-->
</struts>
整个项目中struts2的配置文件就这一个就可以了,如果使用的SPING整合Struts2的
请求的时候直接写sping配置的action名称,因为时间问题就不写太详细了,如有疑问给我发微博,我会回复的,或者加我的MSN
haitao_kang@163.com
<?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.custom.i18n.resources" value="custom"
/> <constant name="struts.locale"
value="zh_CN" /> <constant
name="struts.i18n.encoding" value="UTF-8" />
<constant name="struts.devMode" value="false"
/> <include file="struts-default.xml"
/> <constant
name="struts.objectFactory" value="spring" />
<constant name="struts.devMode" value="false"
/> <constant name="struts.locale"
value="zh_CN" /> <constant
name="struts.multipart.maxSize" value="10000000000000"
/> <constant
name="struts.custom.i18n.resources"
value="messageResource"/> <constant
name="struts.i18n.encoding" value="UTF-8"/>
<package name="cn.struts"
extends="struts-default"> <!-- Level
cn/struts/LevelAction_aa.action 调用LevelAction类
的aa方法--> <action name="*_*"
class="{1}" method="{2}"> <!-- chain
用来处理Action链 com.opensymphony.xwork2.ActionChainResult
--> <result name="chain"
type="chain">${successResultValue}</result>
<!-- dispatcher 用来转向页面,通常处理JSP
org.apache.struts2.dispatcher.ServletDispatcherResult
--> <result
name="dispatcher">${successResultValue}</result>
<!-- httpheader 控制特殊HTTP行为的结果类型
org.apache.struts2.dispatcher.HttpHeaderResult -->
<result name="httpheader"
type="httpheader">${successResultValue}</result>
<!-- redirect 重定向到一个URL
org.apache.struts2.dispatcher.ServletRedirectResult
--> <result name="redirect"
type="redirect">${successResultValue}</result>
<!-- redirectAction 重定向到一个Action
org.apache.struts2.dispatcher.ServletActionRedirectResult
--> <result name="redirectAction"
type="redirectAction">${successResultValue}</result>
<!-- stream
向浏览器发送InputSream对象,通常用来处理文件下载,还可用于返回AJAX数据
org.apache.struts2.dispatcher.StreamResult -->
<result name="stream"
type="stream">${successResultValue}</result>
<!-- velocity 处理Velocity模板
org.apache.struts2.dispatcher.VelocityResult -->
<result name="velocity"
type="velocity">${successResultValue}</result>
<!-- xslt 处理XML/XLST模板
org.apache.struts2.views.xslt.XSLTResult -->
<result name="xslt"
type="xslt">${successResultValue}</result>
<!-- plainText 显示原始文件内容,例如文件源代码
org.apache.struts2.dispatcher.PlainTextResult -->
<result name="plainText"
type="plainText">${successResultValue}</result>
<!-- redirect-action 重定向到一个Action
org.apache.struts2.dispatcher.ServletActionRedirectResult
<result name="redirect-action"
type="redirect-action">${successResultValue}</result>-->
<!-- plaintext 显示原始文件内容,例如文件源代码
org.apache.struts2.dispatcher.PlainTextResult
<result name="plaintext"
type="plaintext">${successResultValue}</result>
--> <!-- freemaker 处理FreeMarker模板
org.apache.struts2.views.freemarker.FreemarkerResult
<result name="freemarker"
type="freemarker">${successResultValue}</result>
--> </action>
</package> <!--
<include
file="struts2.xml"></include>
-->
</struts>
整个项目中struts2的配置文件就这一个就可以了,如果使用的SPING整合Struts2的
请求的时候直接写sping配置的action名称,因为时间问题就不写太详细了,如有疑问给我发微博,我会回复的,或者加我的MSN
haitao_kang@163.com
相关文章推荐
- struts.xml中<package ...>需要注意的地方
- struts.xml文件中<result>的type属性详解
- struts命名空间(basePath)(前两行<%%>不要删)(struts.xml修改以后需要重启服务器)
- struts.xml配置文件中需要注意的地方
- java xml文件操作(转)
- struts2 的struts.xml 配置解释
- 很重要!!!ssh集成的时候struts2 和 spring3集成一定要在struts.xml文件里配置!<constant name="struts.objectFactory" value="sp
- struts-config.xml配置文件顺序异常: The content of element type "struts-config" must match
- Struts 2 框架解析
- Struts2学习笔记——struts.xml配置文件中通配符详解
- struts.xml配置文件中result的语法:<result name="" type="">xxxxx</result>
- centos shell基础 alias 变量单引号 双引号 history 错误重定向 2>&1 jobs 环境变量 .bash_history source配置文件 nohup & 后台运行 cut,sort,wc ,uniq ,tee ,tr ,split, paste cat> 2.txt <<EOF 通配符 glob模式 发邮件命令mail 2015-4-8 第十二节课
- java 读取xml文件并输出
- struts.xml配置文件中result的语法:<result name="" type="">xxxxx</result>
- Struts 2 完整类库 以及配置解析
- SUBLIME&nbsp;TEXT&nbsp;2&nbsp;配置文件详解
- Struts 2 + Spring 2.0 + Hibernat…
- jsp 读取xml文件
- Android xml资源文件中@、@an…
- mybatis mapper.xml文件中配置提示如下错误The entity name must immediately follow the '&' in the entity reference