我想打开2Checkout快递付款表格。我创建了这个测试代码:
JSF代码:
<h:form target="_blank" style="padding: 20px 20px 20px 20px;">
<h:commandButton value="TwoCheckout" action="#{pricingCalculator.initTwoCheckout}" />
</h:form>
CDI Bean:
@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&li_0_price=1.00&li_0_name=Example+Product&sid=1817037&li_0_type=product
但是当我按下h:commandButton
时,页面会在新窗口中刷新。你能告诉我使用h:commandButton
打开回传链接的正确方法是什么?