`

struts2-redirect和redirect-action的一点区别

    博客分类:
  • Java
 
阅读更多

struts2-redirect和redirect-action的一点区别

Java代码
<action name="undoBdChannelOperator" class="bdChannelAction"
    method="undoBdChannelOperator"> 
    <result name="success" type="redirect">getUndoBdChannelListUI.action?operType=${operType}     </result> 
</action>

<action name="undoBdChannelOperator" class="bdChannelAction"
    method="undoBdChannelOperator">
    <result name="success" type="redirect">getUndoBdChannelListUI.action?operType=${operType}     </result>
</action>
可以正常传递参数,而redirect-action不可以
但是可以写出如下形式
Java代码
<!-- 撤销对本地栏目的操作 --> 
<action name="undoBdChannelOperator" class="bdChannelAction"
    method="undoBdChannelOperator"> 
 
    <result name="success" type="redirect-action"> 
     <param name="actionName"> 
      getUndoBdChannelListUI.action 
     </param> 
 
     <param name="operType">${operType}</param> 
     <param name="superCode">${superCode}</param> 
     <param name="webappCode">${webappCode}</param> 
 
    </result> 
 
   </action>

<!-- 撤销对本地栏目的操作 -->
<action name="undoBdChannelOperator" class="bdChannelAction"
    method="undoBdChannelOperator">

    <result name="success" type="redirect-action">
     <param name="actionName">
      getUndoBdChannelListUI.action
     </param>

     <param name="operType">${operType}</param>
     <param name="superCode">${superCode}</param>
     <param name="webappCode">${webappCode}</param>

    </result>

   </action>
另外:type="redirect" 的值可以转到其它命名空间下的action,而redirect-action只能转到同一命名空下的 action,因此它可以省略.action的后缀直接写action的名称。

分享到:
评论

相关推荐

    struts-2.3.15.1

    漏洞根源在于,DefaultActionMapper类支持以"action:"、"redirect:"、"redirectAction:"作为导航或是重定向前缀,但是这些前缀后面同时可以跟OGNL表达式,由于struts2没有对这些前缀做过滤,导致利用OGNL表达式调用...

    struts2中result类型之redirectAction

    struts2中result类型之redirectAction

    Struts2 in action中文版

    11.1 Struts 2框架和Java i18n 241 11.1.1 使用ResourceBundle和Locale取得本地化文本 241 11.1.2 Struts 2如何解决本地Java对i18n支持的问题 243 11.2 Struts 2 i18n示例 244 11.2.1 Struts 2 i18n快速展示 244 ...

    struts2漏洞.rar

    用户可以构造http://host/struts2-blank/example/X.action?action:%25{(new+java.lang.ProcessBuilder(new+java.lang.String[]{'command','goes','here'})).start()}链接,command goes here可以换成是破坏脚本的...

    struts2实例 学生信息管理系统

    struts2实现的学生信息管理系统 &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" ...

    struts_actionforward.rar_ActionForward_redirect

    ActionForward的使用 1、理解全局和局部ActionForward的概念 2、redirect的使用 3、struts-config.xml文件不允许动态修改 4、理解动态ActionForward,动态的ActionForward是可以运行期修改的

    Struts2入门教程(全新完整版)

    2.单选按钮和复选框: 41 3.三种方式实现下拉列表 41 4.二级联动 42 5.其它表单标签 44 6.其它常用标签的使用(代码参名为“补充”的文件夹下的tag.jsp) 45 七、国际化 47 1.action级别下的国际化 47 2.配置package...

    struts2Demo

    struts2演示 &lt;br&gt;1./helloworld - helloworld 2./spring - 与spring整合 3./coc - 惯例优先配置,零配置文件 - codebehind不支持redirect,chain等操作,需要自己写jsp跳转 4./crud - CRUD,Create Read...

    Struts2 2.3.16_doc

    This result uses the ActionMapper provided by the ActionMapperFactory to redirect the browser to a URL that invokes the specified action and (optional) namespace. This is better than the ...

    深入浅出Struts2(附源码)

    作者处处从实战出发,在丰富的示例中直观地探讨了许多实用的技术,如数据类型转换、文件上传和下载、提高Struts 2应用的安全性、调试与性能分析、FreeMarker、Velocity、Ajax,等等。跟随作者一道深入Struts 2,聆听...

    struts2拦截器

    &lt;package name="mySturtsInterceptor" extends="struts-default"&gt; &lt;interceptor name="MyInterceptor" class="com.cn.system.interceptor.MyInterceptor"&gt;&lt;/interceptor&gt; &lt;interceptor-stack name=...

    一个基于struts的重定向和转发实例

    在struts中测试登录的redirect,transmit 一个测试重定向和转发的demo。演示转发到jsp和action的过程。 供参考。

    Apache-Struts-v4

    Apache Struts 2.0.0至2.3.15允许远程攻击者通过带有特制(1)action:,(2)redirect:或(3)redirectAction:前缀的参数来执行任意OGNL表达式。 CVE-2017-5638 Apache Struts 2 2.3.x之前的2.3.x版和2.5.10.1...

    struts2中的result的type类型

    struts2 跳转类型 result type chain dispatcher redirect redirect action

    OA_struts2_hibernate3_spring2.5.rar

    &lt;package name="struts2" extends="struts-default"&gt; &lt;global-results&gt; &lt;result name="add_success" type="redirect"&gt;/common/pub_add_success.jsp &lt;result name="del_success" type="redirect"&gt;/common...

    java考试系统

    (A) struts2-core-2.x.x.jar 包是Struts 2框架的核心类库 (B) struts框架是通过Filter启动的 (C) FilterDispatcher类中的init()方法中将会读取类路径下默认的配置文件struts.xml完成初始化操作 (D) struts2读取到...

    struts2.1宝典

    11.Struts2自动查询目录下的action 35 12.一个Action处理多个业务 method 35 13.使用校验模板校验 35 14.校验模板 35 15.文件上传 36 Struts2 UI tabbed pane tab pane datetime tree 37 SSH Struts+Spring+...

    Struts2学习笔记(2)-路径问题解决

    本文主要介绍Struts2的路径问题,尽量不要使用相对路径,使用相对路径会让路径问题变得很繁琐很麻烦,推荐使用绝对路径,希望能给大家做一个参考。

Global site tag (gtag.js) - Google Analytics