关于struts.xml配置文件中<result>标签的type属性

Result结果类型

 

<result>标签

1.name  与action中的method的返回值匹配,进行跳转.

 

2.type  作用:是用于定义跳转方式

 

对于type属性它的值有以下几种:

在struts-default.xml文件中定义了type可以取的值

 

 <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>

<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>

<result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>

<result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/>

<result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/>

<result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>

<result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/>

<result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/>

<result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>

<result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" />

 

必会: chain  dispatcher  redirect redirectAction  stream

 

dispatcher:它代表的是请求转发,也是默认值。它一般用于从action跳转到页面。

chain:它也相当于请求转发。它一般情况下用于从一个action跳转到另一个action。

 

redirect:它代表的是重定向  它一般用于从action跳转到页面

redirectAction: 它代表的是重定向  它一般用于从action跳转另一个action。

 

stream:代表的是服务器端返回的是一个流,一般用于下载。

 

了解: freemarker  velocity

freemarker: 一种模板技术,通过以流向模板页面输入数据,而得到我们想要的页面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值