redirectAction Result

1.redirectAction Result的作用

  用于将请求重定向给另外一个Action

2.语法

 1. <result name="login" type="redirectAction">

    <param name="namespace">

      /命名空间

    </param>

    <param name="actionName">

      action名

    </param>

  </result>

  2.如果重定向的Action与当前Action在同一个namespace下,则可以省略

  <param name="namespace">/login</param>

  省略后代码如下

    <result name="login" type="redirectAction">

      <param name="actionName">action名</param>

    </result>

  3.如果只需要给result的actionName注入值,配置可以进一步的简化,即

    <result name="login" type="redirectAction">

      action名

    </result>

3.使用步骤

  struts.xml,配置Action

  配置result

    type=‘redirectAction"

    <param name="namespace">/命名空间</param>

    <param name="actionName">action名</param>

时间: 2024-12-11 23:55:41

redirectAction Result的相关文章

Struts2系列:(22) result 和OGNL

简单的描述一下OGNL和result的作用: (1)通过OGNL可以从ActionContext或ValueStack上获取值. (2)对于result,在struts.xml中,可以为action配置不同的处理结果. 本文关注2两个问题:(1)在struts.xml文件中,使用OGNL为result提供dynamic parameter:(2)redirect和redirectAction之间的区别. 1.使用OGNL为result提供dynamic parameter 在struts.xml

【Struts2学习笔记(2)】Action默认值和配置Action于result各种转发类型

一.Action缺省配置值 <span style="font-size:18px;"><package name="itcast" namespace="/test" extends="struts-default"> <action name="helloworld" class="cn.itcast.action.HelloWorldAction" m

Struts相关问题

1.请简述Struts2和Struts1的区别和联系 2.Struts2如何实现MVC,与Spring MVC有什么不同 3.Struts2中页面如何向Action传参 4.OGNL表达式有那些用法,你熟悉其中哪几种 5.请简述Struts2中ValueStack组件运行原理 6.请简述Struts2中个组件的作用及调用顺序 7.获取Session的方式 ActionContext ActionContext.getContext().getSession() 返回类型为Map<String,O

j2ee开发之struts2框架学习笔记

Struts2框架技术重点笔记 1.Struts2 是在webwork基础上发展而来. 2.Struts2 不依赖struts API和 servlet API 3.Struts2提供了拦截器,表现层技术:jsp +freeMarket+ velocity 4.Struts2可以对指定的方法进行校验,提供了全局范围,包范围和action范围的国际化资源文件的管理实现. 环境搭建:找到对应的jar包 编写struts的配置文件 <?xml version="1.0" encodin

struts2 跳转方式,请求分派,重定向

http://localhost:8080/s2_05_HCM_05/hcm/employee/helloworld1.action 成员中的信息默认会保存在request 范围中.注意属性应该保证有set方法.2.默认的转发方式是请求分派 3.http://localhost:8080/s2_05_HCM_05/hcm/employee/message<!-- 如果没有找到指定result,会到继承的base package中找 --> 4.测试重定向 重定向的时候,不能定向到WEB-INF

struts2 跳转类型 result type=chain、dispatcher、redirect(redirect-action)

dispatcher 为默认跳转类型,用于返回一个视图资源(如:jsp) Xml代码 : <result name="success">/main.jsp</result> <result name="success">/main.jsp</result> 以上写法使用了两个默认,其完整的写法为: <result name="success" type="dispatcher&quo

struts2 result类型为redirectAction时,跳转转到另一个包空间里的一个action的指定处理方法的xml配置

xml配置如下: <action name="editTeaAction" class="com.hcj.action.database.admin.EditTeaAction"> <!-- 编辑成功后,转到茶叶信息界面 --> <result name="success" type="redirectAction"> <!-- 指定跳转的action名称 --> <par

struts2 result类型为redirectAction时的参数传递

action部分 <span style="font-size:18px;"><!-- 根据id获取订单列表 --> <action name="<span style="color:#ff0000;">getOrderListByIdAction</span>" class="com.hcj.action.database.GetOrderListByIdAction"&

struts2 result type=(chain、dispatcher、redirect、redirect-action)

(1)type="dispatcher" 为默认,用于jsp页面跳转 <result name="success">/index.jsp</result>  完整的写法为: <result name="success" type="dispatcher">       <param name="location">/index.jsp</param>