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. LookupError: unknown encoding: idna 的处理方法

    写了一个脚本,想把它打包成exe文件,在python编译器中运行正常,但是打包成.exe文件运行报错 LookupError: unknown encoding: idna 找遍资料终于找到了解决方法 ...

  2. aspx子集页面找父级页面元素

    var Obj= window.parent.document.getElementById("ctl00_RightTopTree_hidJsonResult"); Obj.va ...

  3. js操作css样式、js的兼容问题

    一.js操作css样式 div . style . width="200px" 在div标签内我们添加了一个style属性,并设定width值.这种写法会给标签带来大量的style ...

  4. android AutoCompleteTextView 实现手机号格式化,附带清空历史的操作

    有个小伙伴遇到了这样一个问题,就是AutoCompleteTextView实现自动填充的功能.同时要具备手机格式化的功能.下拉列表最后一行是有个清除历史的功能.可是点击“清除历史”却把文字要设置进去A ...

  5. How to proxy a web site by apache2 in Ubuntu

    Install apache2 To execute the install command in terminal: sudo apt-get install apache2 Then, we ca ...

  6. tomcat 的log4j配置问题

    #log4j.rootLogger=DEBUG,stdout,filelog4j.rootLogger=ERROR,stdout,filelog4j.appender.stdout=org.apach ...

  7. 原创:shell两个整数的比较 思想版

    思想是学的 代码创作是自己的 很喜欢前几行的逻辑严谨 #!/bin/bash#判断两个整数的大小read -p "请输入两个整数a b :" a b #或者使用a=$1[ -z & ...

  8. Linux OpenGL 实践篇-11-shadow

    OpenGL 阴影 在三维场景中,为了使场景看起来更加的真实,通常需要为其添加阴影,OpenGL可以使用很多种技术实现阴影,其中有一种非常经典的实现是使用一种叫阴影贴图的实现,在本节中我们将使用阴影贴 ...

  9. [整理]ADB命令行学习笔记

    global driver# 元素定位driver.find_element_by_id("id") # id定位driver.find_element_by_name(" ...

  10. SpringBoot集成FastDFS+Nginx整合基于Token的防盗链

    为什么要用SpringBoot? SpringBoot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人 ...