Action中result的各种转发类型
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的各种转发类型的更多相关文章
- [JavaWeb基础] 021.Action中result的各种转发类型
在struts2中, struts.xml中result的类型有多种,它们类似于struts1中的forward,常用的类型有dispatcher(默认值).redirect.redirectActi ...
- JavaWeb_(Struts2框架)Action中struts-default下result的各种转发类型
此系列博文基于同一个项目已上传至github 传送门 JavaWeb_(Struts2框架)Struts创建Action的三种方式 传送门 JavaWeb_(Struts2框架)struts.xml核 ...
- action中result没有值
action中result没有值,访问action会输出action中的所有数据,输出类型为.action类型 .
- struts2视频学习笔记 03-06(Struts 2配置文件无提示问题,Action配置中的各项默认值,各种转发类型)
课时3 解决Struts 2配置文件无提示问题(eclipse):window→preference→XML→XML Catlog
- 【Struts2学习笔记(2)】Action默认值和配置Action于result各种转发类型
一.Action缺省配置值 <span style="font-size:18px;"><package name="itcast" name ...
- Struts2中Action各种转发类型
Struts2:Action中result的各种转发类型: 内部请求转发dispatcher(默认值) redirect.redirectAction.plainText1.redirect是重定向到 ...
- Struts2 - 配置文件中result 节点详解
每个 action 方法都将返回一个 String 类型的值, Struts 将根据这个值来决定响应什么结果. 每个 action 声明都必须包含有数量足够多的 result 元素, 每个 resul ...
- 04. struts2中Result配置的各种视图转发类型
概述 <action name="helloworld" class="com.liuyong666.action.HelloWorldAction"&g ...
- Struts2中 Result类型配置详解
一个result代表了一个可能的输出.当Action类的方法执行完成时,它返回一个字符串类型的结果码,框架根据这个结果码选择对应的result,向用户输出.在com.opensymphony.xwor ...
随机推荐
- YII2修改backend模块报错An Error occurred while handling another error: exception 'yii\base\InvalidRouteException' with message 'Unable to resolve the request "site/error".' in E:\project\demo\vendor\yiisoft
报错内容: 原因:没有修改common/config/bootstrap.php里的别名 修改后:
- Eclipse Neon Java版本安装Java EE插件
Help→Install New Software 地址:Neon - http://download.eclipse.org/releases/neon/201703231000 选择 Web,X ...
- css新奇技术及其未来发展
1.图像替换技术: 图像替换技术是指使用图像替换页面中文本的功能,类似与在页面中插入图像,只是这种方法更为方便,易于代码管理.通常来说,设计者习惯使用有意义的图像去替换一些标题,logo和某些特定的页 ...
- 520 Detect Capital 检测大写字母
给定一个单词,你需要判断单词的大写使用是否正确.我们定义,在以下情况时,单词的大写用法是正确的: 全部字母都是大写,比如"USA". 单词中所有字母都不是大写,比如&q ...
- 131 Palindrome Partitioning 分割回文串
给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串.返回 s 所有可能的分割方案.例如,给出 s = "aab",返回[ ["aa"," ...
- 刷ID卡的就餐系统
需求分析:公司旧的考勤系统,缺 “就餐”功能模块,不能查询和统计每天的就餐人数.故需开发一个简易的“刷ID卡的就餐系统”,三 部 分组成,一部分为人事资料的增删改查,二部分为处理从“刷卡就餐机”采集的 ...
- .net excel 导入 导出
哎,好好的代码今天说来个实验,结果用的是office15 气死人了,网上最高office14.dll 文章转自2012年 QQ群:13615607 MR.Young protected void Bt ...
- 一些关于Spring的随笔
Spring的IOC.AOP IOC(Inversion of Control): spring容器控制了所有的bean,不用spring以前,一个bean要依赖另一个bean就在这个bean里初始化 ...
- Haproxy+Rabbitmq中的问题
问题一.Rabbitmq集群搭建完成 某个集群节宕机后 无法添加失败 解决办法:停掉所有Rabbitmq服务 并删除集群文件C\Users\Administrator\AppData\Roaming\ ...
- hihocoder1744 hohahola
思路: 二分. 实现: #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = ...