chain   
  
    用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息。   
  
    com.opensymphony.xwork2.ActionChainResult   
  
dispatcher   
  
    用来转向页面,通常处理JSP   
  
    org.apache.struts2.dispatcher.ServletDispatcherResult   
  
freemaker   
  
    处理FreeMarker模板   
  
    org.apache.struts2.views.freemarker.FreemarkerResult   
  
httpheader   
  
    控制特殊HTTP行为的结果类型   
  
    org.apache.struts2.dispatcher.HttpHeaderResult

stream   
  
    向浏览器发送InputSream对象,通常用来处理文件下载,还可用于返回AJAX数据   
  
    org.apache.struts2.dispatcher.StreamResult   
  
velocity   
  
    处理Velocity模板   
  
    org.apache.struts2.dispatcher.VelocityResult   
  
xslt   
  
    处理XML/XLST模板   
  
    org.apache.struts2.views.xslt.XSLTResult   
  
plainText   
  
    显示原始文件内容,例如文件源代码   
  
    org.apache.struts2.dispatcher.PlainTextResult   
  
 
plaintext   
  
    显示原始文件内容,例如文件源代码   
  
    org.apache.struts2.dispatcher.PlainTextResult

redirect   
  
    重定向到一个URL ,被跳转的页面中丢失传递的信息,如request  
  
    org.apache.struts2.dispatcher.ServletRedirectResult   
  
redirectAction   
  
    重定向到一个Action ,跳转的页面中丢失传递的信息,如request     
  
    org.apache.struts2.dispatcher.ServletActionRedirectResult   
  
redirect-action   
  
    重定向到一个Action ,跳转的页面中丢失传递的信息,如request     
  
    org.apache.struts2.dispatcher.ServletActionRedirectResult

注:redirect与redirect-action区别

一、使用redirect需要后缀名 使用redirect-action不需要后缀名
二、type="redirect" 的值可以转到其它命名空间下的action,而redirect-action只能转到同一命名空下的 action,因此它可以省略.action的后缀直接写action的名称。

如:

<result name="success" type="redirect">viewTask.action</result>
<result name="success" type="redirect-action">viewTask</result>

附:redirect-action 传递参数

<action name="enterpreinfo" class="preinfoBusinessAction"    method="enterPreinfoSub">  
  <result name="success" type="redirect-action">  
     showpreinfo?preinfo.order_number=${preinfo.order_number}&amp;preinfo.company_name=${preinfo.company_name}   
  </result>  
 <result name="error" type="redirect">  
    <param name="location">/error.jsp</param>  
 </result>  
</action>

因为使用了redirect-action,所以要注意不能将 showpreinf?preinfo.order_number=${preinfo.order_number}写成 showpreinf.action?preinfo.order_number=${preinfo.order_number}

其中${}为EL表达式,获取action:enterpreinfo中属性的值;在这个配置文件里,多个参数的连接符使用了"&amp;",但XML的语法规范,应该使用"&amp;"代替"&",原理和HTML中的转义相同,开始没有注意,在struts分析配置文件时,总是报出这样的错误:

json   一般很容易忽略的一个地方(在EXT中非常有用)示例view plaincopy to clipboardprint?<package name="struts2" extends="json-default" namespace="/">           <action name="login" class="loginAction" method="login">               <result type="json">                   <param name="includeProperties">success,result</param>                             </result>                        </action>           <action name="main" class="loginAction" method="main">               <result name="main">/index.jsp</result>                    </action>        </package>  <package name="struts2" extends="json-default" namespace="/">
  <action name="login" class="loginAction" method="login">
   <result type="json">
    <param name="includeProperties">success,result</param>    
   </result>    
  </action>
  <action name="main" class="loginAction" method="main">
   <result name="main">/index.jsp</result>   
  </action> 
 </package> view plaincopy to clipboardprint?private boolean success  = true;   private String result = "main.action";   //getter和setter方法略  private boolean success  = true;
private String result = "main.action";
//getter和setter方法略
  以上的success和result互相对应到了view plaincopy to clipboardprint?<param name="includeProperties">success,result</param>    <param name="includeProperties">success,result</param>  struts2会根据其设置的值匹配跳转对于json一般情况下很少用到,但是在处理ext的时候会用到这个属性类型,这个地方也是经常被忽略的。

Struts2配置RESULT中TYPE的参数说明的更多相关文章

  1. struts2的result的type属性

    一共有两个属性name和type name这里就不介绍了 type    返回结果的类型,值可以从default-struts.properties中看到看到 常用的值:dispatcher (默认) ...

  2. 学习Struts--Chap04:result中type属性dispatcher、redirect、redirectAction、chain的区别

    1.Struts2框架中常用的结果类型的分析和比较 dispatcher:缺省的result类型,type默认是dispatcher内部转发.如果不写type类型只写一个名字的话,不单是type类型默 ...

  3. Struts2配置Result(Struts2_result)

    一.概要 二.常用四种类型的配置 Struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!D ...

  4. struts2在result中使用el表达式碰到的问题

    <result name="success">/html/portlet/ext/trainingmanagement/download_file.jsp?path=$ ...

  5. Struts2之配置文件中Action的详细配置(续)

    承接上一篇 4.处理结果的配置 Action类的实例对象调用某个方法,处理完用户请求之后,将返回一个逻辑视图名的字符串.核心Filter收到返回的逻辑视图名字符串,根据struts.xml中的逻辑视图 ...

  6. struts2简单入门-关于Result标签Type属性的说明

    Result标签 作用 当action执行完毕,后要返回什么样的视图. Type属性 决定返回的是什么视图. struts-default.xml的Type属性的定义 <result-types ...

  7. struts-json-plugin result中配置对象的序列化

    注意: 在使用strtus-json-plugin序列化对象属性,配置result标签下includeProperties属性时使用 对象名.*或则指定属性名的方式,不能光写对象属性名. 问题: ac ...

  8. Struts2 配置文件result的name属性和type属性

    Struts2 配置文件result的name属性和type属性:Name属性SUCCESS:Action正确的执行完成,返回相应的视图,success是 name属性的默认值: NONE:表示Act ...

  9. struts2 action result type类型

    struts2 action result type类型 1.chain:用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息. com.opensymphony. ...

随机推荐

  1. Android中Intent的使用

    1./以下是常用到的Intent的URI及其示例,包含了大部分应用中用到的共用Intent. //一.打开一个网页,类别是Intent.ACTION_VIEW Uri uri = Uri.parse( ...

  2. Git分支学习总结

    思维导图:        总结:        Git分支:分为2类合计为5种分支.        第一类:主分支和开发分支.        第二类:特性分支,热补丁分支,版本分支.

  3. 数据采集工具flume

    概述 flume是在2011年被首次引入到Cloudera的CDH3分发中,2011年6月,Cloudera将flume项目捐献给Apache基金会.2012年,flume项目从孵化器变成了顶级项目, ...

  4. SQL Server 启用 xp_cmdshell 与bcp 使用

    启用 xp_cmdshell 1: sp_configure 'show advanced options',1 2: reconfigure 3: GO 4: 5: sp_configure 'xp ...

  5. 设计模式16---设计模式之组合模式(Composite)(行为型)

    1.场景模拟 使用软件模拟大树的根节点和树枝节点和叶子节点 抽象为两类,容器节点和叶子节点 2.不用模式的解决方案 package demo14.composite.example1; import ...

  6. SMO(Sequential Minimal Optimization) 伪代码(注释)

    Algorithm: Simplified SMO 这个版本是简化版的,并没有采用启发式选择,但是比较容易理解. 输入: C: 调和系数 tol: 容差 (tolerance) max passes: ...

  7. tomcat与resin的比较

    Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目,由Apache.Sun 和其他一些公司及个人共同开发而成.由于有了 ...

  8. [ES6] Class Inherit

    In constructor, you can call parent's constuctor() method by supert(); class ShoppingCart { construc ...

  9. CoDel Test Script

    This TCL script is retrieved from http://www.pollere.net/CoDel.html in November 2013 :) # Codel test ...

  10. [serverlet][转载: 深入理解HTTP Session]

    [serverlet][转载: 深入理解HTTP Session] 标签(空格分隔): 未分类 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任. ...