I have two pages myaccount.xhtml and selectbank.xhtml In my account page there is one option for recharge account in which user will enter the amount when user will press su
Well, if your beans are RequestScoped
than you don't have same bean for both pages. These beans are recreated for every request, so you should pass parameters. Change return statement of your gotoPayMethod()
to:
return "SelectBank?faces-redirect=true&includeViewParams=true";
and on selectbank.xhtml
add:
Adapt this to your property and bean name.
If using parameters is not a solution you can add this parameter in the session, and remove it from session in second bean when you retrieve it:
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("amount", amount);
((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getSession().removeAttribute("amount");
Second construction for removing the attribute is necessary as Map
returned from getSessionMap()
is immutable.