struts2 action重定向如何传递参数
1个回答
展开全部
struts2 action提交成功后一般会转到某一jsp。
但有时候需要跳到某一action,一般会用如下方法:Xml代码<result name="success" type="chain"actionName</result
<result name="success" type="chain"actionName</result或者Xml代码<result name="success" type="redirect"actionName.action</result
<result name="success" type="redirect"actionName.action</result
如果这个action后面要带参数,比如xxxAction?id=xxxx
也可以搞定,用下面的方法:Xml代码<action name="updateCampaign" class="campaignAction" method="updateCampaign"
<result name="success" type="redirectAction"
viewCampaignDetail?campaignId=${campaignId}
</result
</action
<action name="updateCampaign"禅岩山 class="campaignAction" method="updateCampaign" <result name="success" type="redirectAction" viewCampaignDetail?campaignId=${campaignId} </result</action或者Xml代码<action name="updateCampaign" class="campaignAction" method="updateCampaign"
<result name="success" type="redirectAction"
<param name="actionName"viewCampaignDetail</param
<param name="campaignId"${campaignId}</param
</result
ps:传递枣橡的参贺中数,在对应的action中必须有set方法且将值set进去
但有时候需要跳到某一action,一般会用如下方法:Xml代码<result name="success" type="chain"actionName</result
<result name="success" type="chain"actionName</result或者Xml代码<result name="success" type="redirect"actionName.action</result
<result name="success" type="redirect"actionName.action</result
如果这个action后面要带参数,比如xxxAction?id=xxxx
也可以搞定,用下面的方法:Xml代码<action name="updateCampaign" class="campaignAction" method="updateCampaign"
<result name="success" type="redirectAction"
viewCampaignDetail?campaignId=${campaignId}
</result
</action
<action name="updateCampaign"禅岩山 class="campaignAction" method="updateCampaign" <result name="success" type="redirectAction" viewCampaignDetail?campaignId=${campaignId} </result</action或者Xml代码<action name="updateCampaign" class="campaignAction" method="updateCampaign"
<result name="success" type="redirectAction"
<param name="actionName"viewCampaignDetail</param
<param name="campaignId"${campaignId}</param
</result
ps:传递枣橡的参贺中数,在对应的action中必须有set方法且将值set进去
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询