您的位置:首页 > 编程语言 > Java开发

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐