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 ...
随机推荐
- 并查集 HDOJ 1232 畅通工程
题目传送门 /* 并查集(Union-Find)裸题 并查集三个函数:初始化Init,寻找根节点Find,连通Union 考察:连通边数问题 */ #include <cstdio> #i ...
- JAVA线程操作常见面试题 包括不使用内部类对多个线程加减1
class ManyThreads2 { private int j = 0; public synchronized void inc() { j++; System.out.println(Thr ...
- innobackupex的使用
优点: 不暂停服务器创建Innodb热备份 为mysql做增量的备份 在mysql服务器之间做在线表迁移 使创建mysql replication更加容易 备份mysql但不增加服务器的负载 安装:x ...
- RHEL 6.5----Varnish缓存服务器
主机名 IP 服务 master 192.168.30.130 varnish slave 192.168.30.131 httpd WebServer 192.168.30.1 ...
- jQuery选择器之表单对象属性筛选选择器
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content ...
- 使用MySQL统计页面访问及排名
统计访问页面数量,以分辨率进行排名 SELECT CONCAT(`height` , '*', `width`) AS `resolution` , COUNT(CONCAT(`height`, '* ...
- 清理xcode缓存
code版本:8.3.3 iOS版本:10.3.2 移除 Xcode 运行安装 APP 产生的缓存文件(DerivedData) 只要重新运行Xcode就一定会重新生成,而且会随着运行程序的增多,占用 ...
- sql 删除重复数据
DELETE a FROM tbBuilding a WHERE EXISTS (SELECT 1 FROM tbBuilding b WHERE b.Province = a.Province AN ...
- 简单修改BOOK主题样式
body{ font-size: 13px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; margin: 0px; word ...
- Python 风格规范
分号 不要在行尾加分号, 也不要用分号将两条命令放在同一行. 行长度 每行不超过80 个字符 例外: 如果使用Python 2.4 或更早的版本, 导入模块的行可能多于80 个字符. Pyth ...