- 浏览: 49011 次
文章分类
最新评论
今天在用struts2在做项目时候,从一个action我想跳转到另一个action,并且呢得带上值。说说我的做法吧,首先你得在你的第一个action中这个id必须要有set、get方法。
跳转时你的struts.xml:
(方法一):
<result name="topic" type="redirect">/topicAction!findTopics.do?topicId=${topicId}</result>
(方法二):
<result name="topic" type="redirect-action">
<param name="actionName">findTopics</param>
<param name="topicId">${topicId}</param>
</result>
如果是多个参数的话,继续再加几个<param>就行了,对于(方法一)如果是多个参数的怎么办? <result name="topic" type="redirect">/topicAction!findTopics.do?topicId=${topicId}&elementId=${elementId}</result>
这不就行了。
总结下:
dispatcher jsp --- jsp
redirect action --- action
chain jsp--jsp或者是action---action
跳转时你的struts.xml:
(方法一):
<result name="topic" type="redirect">/topicAction!findTopics.do?topicId=${topicId}</result>
(方法二):
<result name="topic" type="redirect-action">
<param name="actionName">findTopics</param>
<param name="topicId">${topicId}</param>
</result>
如果是多个参数的话,继续再加几个<param>就行了,对于(方法一)如果是多个参数的怎么办? <result name="topic" type="redirect">/topicAction!findTopics.do?topicId=${topicId}&elementId=${elementId}</result>
这不就行了。
总结下:
dispatcher jsp --- jsp
redirect action --- action
chain jsp--jsp或者是action---action
发表评论
-
java 如何判断操作系统是Linux还是Windows
2014-02-11 09:59 804System.out.println("== ... -
MyEclipse控制台输入中文乱码解决
2013-11-21 22:46 1341修改MyEclipse的配置文件,在myeclipse的安装目 ... -
ref bean与ref local区别
2013-11-08 09:32 398<bean id="userDAOPro ... -
win7 系统中host文件的位置
2013-10-31 11:06 650C:\Windows\System32\drivers\etc ... -
MyEclipse设置JSP页面默认编码方式以及设置在Java文件中作者、日期等说明
2013-10-24 17:48 546MyEclipse设置JSP页面默认编码方式: windo ... -
获取当前的准确时间
2013-09-16 12:10 588Calendar c=Calendar.getInstance ... -
myeclipse中svn图标状态(同步标记)不显示问题的解决方法
2013-09-05 10:21 626今天从SVN服务器上down下工程后,发现myeclipse ... -
hibernate Criteria
2013-08-05 10:31 561方法 描述 Expressio ... -
比较大小
2013-08-04 17:13 489int a=5000; int b=5000; a==b ... -
时间类型的转化
2013-05-29 15:09 641SimpleDateFormat df=new SimpleD ... -
java list 判断对象是否存在
2013-11-11 15:20 4197String tags=this.getPublish() ... -
GET方式传中文参数给Struts2 Action时出现乱码
2013-05-10 09:43 1002GET方式传中文参数给Struts2 Action时出现乱码 ... -
proteced 作用范围
2013-04-27 19:27 561struts2 ajax 页面得不到类中的变量的值。可能是因 ... -
自动生成java注册码的java代码
2013-04-02 16:47 0import java.io.BufferedReader ... -
hibernate查询的6种方法
2013-03-23 10:22 419hibernate查询的6种方法。分别是HQL查询,对象化查 ... -
hibernate Criteria DetachedCriteria
2013-03-23 10:11 513Criteria 是在线的,所 以它是由 Hibernat ... -
支付宝源码
2013-03-22 11:16 518支付宝的相关操作 -
java获得图片的像素
2013-03-22 10:21 670ImageIcon img= new Imag ... -
java 发邮件
2013-03-21 14:31 725package com.qhkj.goodChance.c ... -
临时的
2013-03-20 18:09 593@Transactional public String ...
相关推荐
<result type="redirect">List.action</result> </action> <action name="Remove" class="action.BookAction" method="remove"> <result type="redirect">List.action</result> </action>--> </package> </...
<result name="add_success" type="redirect">/common/pub_add_success.jsp</result> <result name="del_success" type="redirect">/common/pub_del_success.jsp</result> <result name="modify_success" ...
<result name="login" type="redirect">/index.jsp</result> </global-results> <action name="action_*" class="personAction" method="{1}"> <interceptor-ref name="myInterceptorStack"></interceptor-ref...
<?xml version="1.0" encoding="UTF-8" ?... <result name="success" type="redirect">/employee/success.jsp</result> <result name="input" >/employee/add.jsp</result> </action> </package> </struts>
struts2中result类型之redirect,重定向
struts2 跳转类型 result type chain dispatcher redirect redirect action
org.apache.struts2.views.freemarker.FreemarkerResult 16 httpheader 16 控制特殊http行为的结果类型 16 org.apache.struts2.dispatcher.HttpHeaderResult 16 stream 16 向浏览器发送InputSream对象,通常用来处理...
This result uses the ActionMapper provided by the ActionMapperFactory to redirect the browser to a URL that invokes the specified action and (optional) namespace. This is better than the ...
result 节点的 name、type 属性的具体含义 2)、讲授 dispatcher、redirect、redirectAction、chain 等结果类型 3)、讲授 Struts2 的 exception 映射 4)、 讲授 action 配置的通配符 5)、 讲授动态方法调用
SSH笔记 result标签里面 type的使用 demo包括dispatcher、chain、redirect、redirectAction、stream
11、struts.xml中result的type有哪些类型? 91 12、什么时候用JDBC什么时候用Hibernete; 91 13、hibernate 数据的三个状态 91 14、Hibernate中load和get的区别? 92 15、Hibernate的工作原理? 92 16、hibernate优...