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&li_0_price=1.00&li_0_name=Example+Product&sid=1817037&li_0_type=product
しかし、ページを押すとh:commandButton
、新しいウィンドウでページが更新されます。を使用してリターン リンクを開く適切な方法を教えてくださいh:commandButton
。