Action中result的各种转发类型

1,dispatcher:默认值  ,内部定向

<result>/WEB-INF/page/employeeAdd.jsp</result>

2,redirect:浏览器重定向

<result type="redirect">/index.jsp</result>

3, redirectAction 重定向到action
//同一个包下的
<result type="redirectAction">actionname</result>
//不同包下的
<result type="redirectAction">
<param name="actionName">XXX</param>
<param name="namespace" >XXX</param> </result> 4, plainText:输出视图的代码
<result type="plainText">/index.jsp</result>
//指定编码
<result type="plainText">
<param name="location">/index.jsp</param>
<param name="charSet">UTF-8</param> </result> 5,<global-results> 全局视图
//为了能让所有的包,都可以使用该视图
<package name="base" extends="struts-default">
<global-results >
<result name="message">/WEB-INF/page/message.jsp</result>
</global-results>
</package>
//然后其他包继承该包就可以了 6,为action注入属性值
<action name="helloworld" class="cn.itcast.action.HelloWorldAction" method="execute" >
<param name="savepath">/image</param>
<result name="success">/WEB-INF/page/MyJsp.jsp</result>
</action>
//这样hellowoldAction 中的savapath属性值就是/image

Action中result的各种转发类型的更多相关文章

  1. [JavaWeb基础] 021.Action中result的各种转发类型

    在struts2中, struts.xml中result的类型有多种,它们类似于struts1中的forward,常用的类型有dispatcher(默认值).redirect.redirectActi ...

  2. JavaWeb_(Struts2框架)Action中struts-default下result的各种转发类型

    此系列博文基于同一个项目已上传至github 传送门 JavaWeb_(Struts2框架)Struts创建Action的三种方式 传送门 JavaWeb_(Struts2框架)struts.xml核 ...

  3. action中result没有值

    action中result没有值,访问action会输出action中的所有数据,输出类型为.action类型 .

  4. struts2视频学习笔记 03-06(Struts 2配置文件无提示问题,Action配置中的各项默认值,各种转发类型)

    课时3 解决Struts 2配置文件无提示问题(eclipse):window→preference→XML→XML Catlog

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

    一.Action缺省配置值 <span style="font-size:18px;"><package name="itcast" name ...

  6. Struts2中Action各种转发类型

    Struts2:Action中result的各种转发类型: 内部请求转发dispatcher(默认值) redirect.redirectAction.plainText1.redirect是重定向到 ...

  7. Struts2 - 配置文件中result 节点详解

    每个 action 方法都将返回一个 String 类型的值, Struts 将根据这个值来决定响应什么结果. 每个 action 声明都必须包含有数量足够多的 result 元素, 每个 resul ...

  8. 04. struts2中Result配置的各种视图转发类型

    概述 <action name="helloworld" class="com.liuyong666.action.HelloWorldAction"&g ...

  9. Struts2中 Result类型配置详解

    一个result代表了一个可能的输出.当Action类的方法执行完成时,它返回一个字符串类型的结果码,框架根据这个结果码选择对应的result,向用户输出.在com.opensymphony.xwor ...

随机推荐

  1. 树状数组 POJ 2481 Cows

    题目传送门 #include <cstdio> #include <cstring> #include <algorithm> using namespace st ...

  2. Win7系统出现提示: “Windows已遇到关键问题,将在一分钟后自动重新启动。”

    1. 若用户在使用Win7系统时,遇到上述系统故障,建议重启电脑.等电脑开机自检一过,马上按键盘上的F8键,选择进入安全模式.在安全模式下,进行系统还原.其他的解决方法见下. 1.或者,在安全模式下, ...

  3. string类常用方法3

  4. 508 Most Frequent Subtree Sum 出现频率最高的子树和

    详见:https://leetcode.com/problems/most-frequent-subtree-sum/description/ C++: /** * Definition for a ...

  5. Java 设置Word页面背景色

    Word中可以针对不同文档排版设计要求来设置背景设置颜色.常见的可设置单一颜色.渐变色或加载指定图片来设置成背景.下面通过Java来设置以上3种Word页面背景色. 使用工具:Spire.Doc fo ...

  6. QQ面板拖拽(慕课网DOM事件探秘)(上)

    QQ面板拖拽,效果如图 JavaScript代码如下: function getByClass(clsName, parent) { var oParent = parent ? document.g ...

  7. 【学习笔记】比特(bit)、字,字节(B)存储单位之间的关系+其与操作系统位数的关系+不同编译器编译方式下数据类型的表示范围

    1.在表示网络传输速度中与表示存储单位的不同: 表示存储单位时:1kB=1024B,但在网络中表示传输速度是1KB=1000B 2.下面介绍表示存储单位时的关系及其与操作系统位数的关系: 1B=8bi ...

  8. Es6学习笔记(7)----数组的扩展

    参考书<ECMAScript 6入门>http://es6.ruanyifeng.com/ 数组的扩展 1.扩展运算符:可以将数组转化成逗号隔离的单个参数...[1,2,3] //控制台运 ...

  9. XDroidMvp 轻量级的Android MVP快速开发框架

    XDroidMvp是XDroidAndroid快速开发框架的MVP版本,其使用方式类似于XDroid,大部分源码也来自XDroid. XDroidMvp主要会有这些特性: 无需写Contract! 无 ...

  10. iOS 蒲公英第三方打包平台

    http://www.pgyer.com/doc/view/ios_install_failed