【发布时间】:2015-01-26 19:53:48
【问题描述】:
我在我的 Struts 2 Web 项目中使用 PayPal Sandbox。
我有一个包含 PayPal 表单的 payment-method.jsp:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<!-- other stuff -->
<input type="hidden" name="return" value="payment">
<input type="hidden" name="cancel_return" value="http://localhost:8080/mysite/payment-method.jsp">
<!-- payment button -->
</form>
我已将return 值指定为payment。
我在struts.xml 中定义了操作:
<action name="payment" class="com.mypackage.action.PaymentAction">
<result>/transaction-result.jsp</result>
</action>
但它正在返回 PayPal Sandbox 主页。
在用户在 PayPal 中完成交易后,我如何重定向到某个操作(而不是实际页面)?
(顺便说一句,cancel_return 工作。)
【问题讨论】:
-
您想重定向到
jsp或其他操作? -
在
return,我想重定向到一个动作。 -
那么在这种情况下,您需要将
<action name="payment" class="ph.watchy.action.PaymentAction"> <result>/transaction-result.jsp</result> <result name="index" type="redirect">/index.jsp</result> </action>更改为<action name="payment" class="ph.watchy.action.PaymentAction"> <result>/transaction-result.jsp</result> <result name="index" type="redirect">ActionName to which you want redirect</result> </action>
标签: java jsp redirect paypal struts2