struts2 <result type="redirect">

Today, when I am working on a project with struts2, I want to jump from one action to another, and I have to bring the value. Let me talk about my approach. First of all, you must have set and get methods for this id in your first action.
Your struts.xml when jumping:
(Method 1):
<result name="topic" type="redirect">/topicAction!findTopics.do?topicId=${topicId}</result>
(Method 2):
< result name="topic" type="redirect-action">
<param name="actionName">findTopics</param>
<param name="topicId">${topicId}</param>
</result>

if more If there are several parameters, just add a few more <param>s. What if there are multiple parameters (method 1)? <result name="topic" type="redirect">/topicAction!findTopics.do?topicId=${topicId}&elementId=${elementId}</result>
This is not enough.

To sum up:
dispatcher jsp --- jsp
redirect action --- action
chain jsp--jsp or action---action

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326764552&siteId=291194637