-
1. Re: How to restore the FacesContext
v.bannur Jul 11, 2011 2:05 AM (in response to v.bannur)Any help or any suggestions please?
-
2. Re: How to restore the FacesContext
tommy_bo Jul 14, 2011 3:44 AM (in response to v.bannur)I believe these are seperate requests, so you should not try to restore the facescontext. Rather use a ViewScoped bean or store information in the session. Also if the payment-application verifies the payment with a callback (not clientside redirect) this would be in another session, so you have to pull this verification from your database or an applicationwide context.
-
3. Re: How to restore the FacesContext
v.bannur Jul 15, 2011 7:35 AM (in response to tommy_bo)Hi Tommy,
In my application the logged in user details keeping in a session as below.
FacesUtils.getCurrentSession().setAttribute("UserBean", userbean);
Class FacesUtils(){
public static HttpSession getCurrentSession() {
return (HttpSession) getFacesContext().getExternalContext().getSession(false);
}
public static HttpServletRequest getRequestObject(){
return (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
}
public static HttpServletResponse getResponseObject() {
return (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
}
}
And one of the JSF backing bean calling the JSP (paymentportal.jsp) as code given below .Intern this JSP calls the payementGateway application (Which is developed in another technologies).
The payment gatewya application URL is: https://demo-ipg-test/Payment/PaymentPortal.aspx?layout=CONBEISDF
HttpServletResponse response = FacesUtils.getResponseObject();
response.sendRedirect(response.encodeRedirectURL("./../../jsp/paymentportal.jsp"));
After success full payment, control redirects to one of the servlet defined in my application.
I need the ‘userbean’ from the session in this servlet. How could I access the ‘userbean’ stored in the session?
Can you please help me or can you give me any suggestion how can I handle this issue?
-
4. Re: How to restore the FacesContext
nbelaevski Jul 16, 2011 2:44 AM (in response to v.bannur)Hi,
You should be able to take this object using HttpSession#getAttribute - this doesn't require JSF at all. Check Servlet spec for more information.
-
5. Re: How to restore the FacesContext
v.bannur Jul 17, 2011 3:30 AM (in response to nbelaevski)Hi Nick,
You are absolutely right. I already tried by getting HttpSession#getAttribute, but I got null value.
Because I am setting session using
FacesUtils.getCurrentSession().setAttribute("UserBean", userbean);
public static HttpSession getCurrentSession() {
return (HttpSession) getFacesContext().getExternalContext().getSession(false);
}