`

struts2 <result type="redirect">

 
阅读更多
今天在用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}&amp;elementId=${elementId}</result>
这不就行了。

总结下:
dispatcher jsp --- jsp
redirect action --- action
chain jsp--jsp或者是action---action
分享到:
评论

相关推荐

    struts2实例 学生信息管理系统

    &lt;result type="redirect"&gt;List.action&lt;/result&gt; &lt;/action&gt; &lt;action name="Remove" class="action.BookAction" method="remove"&gt; &lt;result type="redirect"&gt;List.action&lt;/result&gt; &lt;/action&gt;--&gt; &lt;/package&gt; &lt;/...

    OA_struts2_hibernate3_spring2.5.rar

    &lt;result name="add_success" type="redirect"&gt;/common/pub_add_success.jsp&lt;/result&gt; &lt;result name="del_success" type="redirect"&gt;/common/pub_del_success.jsp&lt;/result&gt; &lt;result name="modify_success" ...

    struts2拦截器

    &lt;result name="login" type="redirect"&gt;/index.jsp&lt;/result&gt; &lt;/global-results&gt; &lt;action name="action_*" class="personAction" method="{1}"&gt; &lt;interceptor-ref name="myInterceptorStack"&gt;&lt;/interceptor-ref...

    structs2动态添加表单

    &lt;?xml version="1.0" encoding="UTF-8" ?... &lt;result name="success" type="redirect"&gt;/employee/success.jsp&lt;/result&gt; &lt;result name="input" &gt;/employee/add.jsp&lt;/result&gt; &lt;/action&gt; &lt;/package&gt; &lt;/struts&gt;

    struts2中result类型之redirect

    struts2中result类型之redirect,重定向

    struts2中的result的type类型

    struts2 跳转类型 result type chain dispatcher redirect redirect action

    Struts2入门教程(全新完整版)

    org.apache.struts2.views.freemarker.FreemarkerResult 16 httpheader 16 控制特殊http行为的结果类型 16 org.apache.struts2.dispatcher.HttpHeaderResult 16 stream 16 向浏览器发送InputSream对象,通常用来处理...

    Struts2 2.3.16_doc

    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 ...

    struts应用5

    result 节点的 name、type 属性的具体含义 2)、讲授 dispatcher、redirect、redirectAction、chain 等结果类型 3)、讲授 Struts2 的 exception 映射 4)、 讲授 action 配置的通配符 5)、 讲授动态方法调用

    SSH笔记-result标签的type的使用

    SSH笔记 result标签里面 type的使用 demo包括dispatcher、chain、redirect、redirectAction、stream

    Java面试宝典2020修订版V1.0.1.doc

    11、struts.xml中result的type有哪些类型? 91 12、什么时候用JDBC什么时候用Hibernete; 91 13、hibernate 数据的三个状态 91 14、Hibernate中load和get的区别? 92 15、Hibernate的工作原理? 92 16、hibernate优...

Global site tag (gtag.js) - Google Analytics