struts2 result随笔】的更多相关文章

 一.result:chain(从一个Action转发到另一个Action) chain结果类型有4个属性,分别是: actionName (default) - the name of the action that will be chained to namespace - used to determine which namespace the Action is in that we're chaining. If namespace is null, this defaults t…
Result的四个常用转跳类型分别为 Dispatcher 用来转向页面,是Struts的默认形式 Redirect   重定向到一个URL Chain  用来处理Action链 RedirectAction     重定向到一个Action 还有以下几种不太常用 freemaker: 处理FreeMarker模板 httpheader: 控制特殊HTTP行为的结果类型 stream:    向浏览器发送InputSream对象,用来处理文件下载,还可用于返回AJAX数据 velocity :…
jsp: <body> <a href="stream.action?fileName=psb.jpg">psb</a> <br> </body> action: public class StreamAction { private String fileName; public String execute(){ return Action.SUCCESS; } public InputStream getInputStr…
result标签中type的类型 类型 说明 chain 用于Action链式处理 dispatcher 用于整合JSP,是<result>元素默认的类型 freemarket 用来整合FreeMarket httpheader 用来处理特殊的HTTP行为 redirect 用来重定向到其它文件 redirectAction 用来重定向到其它Action stream 用来香浏览器返回一个InputStream velocity 用来整合Velocity xslt 用来整合XML/XSLT p…
转自:http://www.cnblogs.com/liaojie970/p/7151103.html 在struts2框架中,当action处理完之后,就应该向用户返回结果信息,该任务被分为两部分:结果类型和结果本身. 结果类型 提供了返回给用户信息类型的实现细节.结果类型通常在Struts2中就已预定义好了(见下表),或者是由插件提供,开发人员也可以自定义结果类型.默认 配置的结果类型是dispatcher,该结果类型使用JSP来向用户显示结果.当定义了结果类型之后,该结果类型可以在不同的a…
Struts2支持的不同类型的返回结果为: type name 说明 dispatcher 缺省类型,用来转向页面,通常处理JSP chain 转向另一个action,用来处理Action链 redirect 重定向到一个URL redirectAction 重定向到一个Action stream 向浏览器发送InputSream对象,通常用来处理文件下载 freeMarker 处理FreeMarker模板 HttpHeader 用来控制特殊的Http行为 Velocity 处理Velocity…
目前只使用过以下3种,都是直接跳转到另一个action  chain: 写法:<result name="success" type="chain">nextAction</result> nextAction前面不加[/]斜线,上一个action中request中设置的值,在nextAction中可以取到 redirect: 写法:<result name="success" type="redirect…
一共十种类型 1.dispatcher 默认的类型,相当于servlet的foward,服务器端跳转.客户端看到的是struts2中配置的地址,而不是真正页面的地址.一般用于跳转到jsp页面 2.redirect.redirect-action 页面重定向,客户端跳转:前者用于跳转到jsp页面,后者用于跳转到action 3.chain 将请求转发到一个action 4.stream 一般用于下载文件用 5.PlainText 普通文本 6.Velocity(Velocity) 用于与Veloc…
首先看一下在struts-default.xml中对于result-type的定义: <result-types><result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/><result-type name="dispatcher" class="org.apache.struts2.dispatcher.Ser…
1):result的name属性   例如:<result name="success">/pages/success.jsp</result> Struts 2带有一个可选的动作接口(com.opensymphony.xwork2.Action).通过实现这个接口,它带来了一些方便和好处,看下面的源代码 package com.opensymphony.xwork2; public interface Action { public static final…