博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
struts2 result type=(chain、dispatcher、redirect、redirect-action)
阅读量:6982 次
发布时间:2019-06-27

本文共 1172 字,大约阅读时间需要 3 分钟。

(1)type="dispatcher" 为默认,用于jsp页面跳转 

<result name="success">/index.jsp</result>  
完整的写法为: 
<result name="success" type="dispatcher">  
     <param name="location">/index.jsp</param>  
</result>

 

 

(2)type="redirect" 重定向到jsp、action、外部网址

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

<result name="success" type="redirect">/login.do</result>  
<result name="success" type="redirect">http://www.baidu.com</result>

 

重定向时带参数处理方法:

1.type="redirect":  

<result name="success" type="redirect">/login.do?userId=${userId }</result>  
2.type="redirect-action":  
见(3)

 

(3)type="redirect-action" 重定向到另外一个action 

<result name="success" type="redirect-action">  

     <param name="actionName">login.do</param> 重定向action名
     <param name="userId">userId</param>带的参数

</result>

 

(4)type="chain" 用于action跳转。   

<action name="action1" class="org.Action1">  

     <result name="success" type="chain">action2.do</result>  
</action>  
<action name="action2" class="org.Action2">  
     <result name="success">login.jsp</result>  
</action>

(5)type="plaintextj" 跳转显示源代码

<result name="err" type="plaintext">  

    <param name="location">具体的位置</param>  
    <param name="charSet">字符规范(如GBK)</param>  
</result>

转载于:https://www.cnblogs.com/aiwoqu/p/4349859.html

你可能感兴趣的文章
实验(一):认识数据库的参数文件
查看>>
\做为分割符要注意的问题
查看>>
解决使用perl lwp访问网页乱码的问题
查看>>
java json和object互换
查看>>
IT技术晋级之路-系统分区
查看>>
脚本语言程序员怎么学习程序设计?
查看>>
Enterprise Library 2.0 Hands On Lab 翻译(15):加密应用程序块(二)
查看>>
帮助电力,轻松实现运维管理
查看>>
三地跨区域链路 汇聚统一监控平台——国际化综合性顾问咨询公司阿特金斯
查看>>
SQL SERVER与MYSQL 的重复插入的区别
查看>>
cocos2d-x学习笔记09:动作2:持续动作
查看>>
网络嗅探软件全接触(2)
查看>>
J0ker的CISSP之路:复习-Information Security Management(4)
查看>>
使用CSS 3创建不规则图形
查看>>
SCOM 2007 R2监控系统安装部署(三)安装SCOM报表服务器和审计服务器
查看>>
服务契约
查看>>
Lync Server 2010标准版系列PART6:启用Lync
查看>>
.net framework3.5新特性1:Lambda表达式
查看>>
虚拟化系列-Citrix XenServer 6.1 网络管理
查看>>
是谁令我离开生活了16年的广州
查看>>