0

我想打开 2Checkout 快速付款表单。我创建了这个测试代码:

JSF 代码:

<h:form target="_blank" style="padding: 20px 20px 20px 20px;">
    <h:commandButton value="TwoCheckout" action="#{pricingCalculator.initTwoCheckout}" />
</h:form>

CDI 豆:

@Named
@ViewScoped
public class PricingCalculator implements Serializable {

    public String initTwoCheckout() throws Exception {
        HashMap<String, String> params = new HashMap<>();
        params.put("sid", "1817037");
        params.put("mode", "2CO");
        params.put("li_0_type", "product");
        params.put("li_0_name", "Example Product");
        params.put("li_0_price", "1.00");

        String message = TwocheckoutCharge.url(params);
        return message;
    }
}

我打印了我得到 http 链接的输出https://www.2checkout.com/checkout/spurchase?mode=2CO&amp;li_0_price=1.00&amp;li_0_name=Example+Product&amp;sid=1817037&amp;li_0_type=product

但是当我按下h:commandButton页面时,页面只是在新窗口中刷新。你能告诉我打开返回链接的正确方法是什么h:commandButton吗?

4

0 回答 0