struts2 中 result type="stream"】的更多相关文章

Stream result type是Struts2中比较有用的一个feature.特别是在动态生成图片和文档下载的情况下 1:图片验证码: Action类,action主要要提供一个获取InputStrem的方法: public class CheckCodeAction extends ActionSupport implements SessionAware { private Logger log = LoggerFactory.getLogger(this.getClass()); p…
Struts2 中result type属性说明 首先看一下在struts-default.xml中对于result-type的定义: <result-types><result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/><result-type name="dispatcher" class="org.apac…
<!--struts.xml配置--> <action name="download" class="com.unmi.action.DownloadAction"> <result name="success" type="stream"><!--type 为 stream 应用 StreamResult 处理--> <param name="contentTy…
转自:http://wangquanhpu.iteye.com/blog/1461750 1, ignoreHierarchy 参数:表示是否忽略等级,也就是继承关系,比如:TestAction 继承于 BaseAction,那么 TestAction 中返回的 json 字符串默认是不会包含父类 BaseAction 的属性值,ignoreHierarchy 值默认为 true,设置为 false 后会将父类和子类的属性一起返回. <result type=”json”> <param…
struts2 action result type类型 1.chain:用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息. com.opensymphony.xwork2.ActionChainResult 2.dispatcher:用来转向页面,通常处理JSP org.apache.struts2.dispatcher.ServletDispatcherResult 3.freemaker:处理FreeMarker模板 org.apache.strut…
chain           用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息.           com.opensymphony.xwork2.ActionChainResult       dispatcher           用来转向页面,通常处理JSP           org.apache.struts2.dispatcher.ServletDispatcherResult       freemaker           处理Fr…
一个result代表了一个可能的输出.当Action类的方法执行完成时,它返回一个字符串类型的结果码,框架根据这个结果码选择对应的result,向用户输出.在com.opensymphony.xwork2.Action接口中定义了一组标准的结果代码,可供开发人员使用,当然了只有我们的action继承ActionSupport 这个类才可以使用下面的结果代码,如下所示:public interface Action{    public static final String SUCCESS =…
result type: dispatcher,redirect:只能跳转到jsp,html之类的页面,dispatcher属于服务器跳转, redirect属于客户端跳转 chain: 等同于forwardaction, redirectAction: 客户端跳转到另一个action 还有freemarker,httpheader,stream(下载),volocity(类似freemarker), xslt, plaintext,tiles <?xml version="1.0&quo…
概述 <action name="helloworld" class="com.liuyong666.action.HelloWorldAction"> <result name="success">/WEB-INF/page/hello.jsp</result> </action> result配置类似于struts1中的forward,但struts2中提供了多种结果类型,常用的类型有: dis…
在struts2配置XML里,result中type属性有以下几种: 1.dispatcher:服务器跳转到前台,后面跟着可以是JSP.htm等等前台页面,默认是这种. 2.redirect:客户端跳转到前台,后面跟着可以是JSP.htm等前天页面. 3.chain:服务器跳转到其他Action,后面跟着是其他的Action名称,被跳转的Action中仍能获取上个页面的值,如request信息. 4.redirectAction:客户端跳转到其他Action,后面跟着是其他的Action名称,被…