2

外部サイトがユーザーを私のプラットフォームにリダイレクトし、いくつかの POST データを渡します。Bean からこの情報を取得して JSF ページに表示するにはどうすればよいですか?

私は多くの解決策を試しましたが、誰もうまくいきません。以下は、JSF テスト ページです。

 <f:metadata>
  <f:viewParam name="auth" value="#{getResponse2.auth}" required="true"/>
 </f:metadata>

<ui:define name="content">
    <center>
       An error occurred during  transaction
        #{getResponse2.auth}<br />
        #{getResponse2.responsecode}
    </center>

ここで、POST データを取得しようとする試みがいくつかあります。

@ManagedBean
@RequestScoped
public class getResponse extends HttpServlet {
   private String paymentId;
   private String result;
   private String auth;
   private String ref;
   private String traind;
   private String trackid;
   private String udf1;
   private String responsecode;
   private String host;
   @Override
   public void doPost(HttpServletRequest request, HttpServletResponse response) {
      paymentId = request.getParameter("paymentid");
      result = request.getParameter("result");
      auth = request.getParameter("auth");
      ref = request.getParameter("ref");
      traind = request.getParameter("tranid");
      trackid = request.getParameter("trackid");
      udf1 = request.getParameter("udf1");
      responsecode = request.getParameter("responsecode");
      System.out.println("response code: " + responsecode);
  }

別のもの:

   public void getResponse() {

    paymentId = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter("paymentId");
    result = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter("result");
    auth = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter("auth");
    ref = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter("ref");
    traind = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter("traind");
    trackid = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter("trakid");
    udf1 = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter("udf1");
    responsecode = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter("responsecode");

}
4

0 に答える 0