Pass request parameters through FacesContext

actionlistener, jsf-2, managed-bean, parameter-passing

Solution

In step 2, if there is a redirect the initial request scope is lost as the redirect would result in another request.

Problem

I moved from JSF 1.2 to JSF 2.0 and it seems I missed something during the switch. I have following scenario: - There is a button on one page with actionListener set to one managed bean's method which adds an object to request by calling `FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("foo", fooObject);` - Navigation is properly handled to other page where other managed bean is initialized. - The constructor of other managed bean tries to retrieve passed object from request by calling `FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("foo");` and to initialize itself with received values. Both managed beans are request scoped. I notice that constructor can't retrieve proper value from request because request map doesn't contain "foo" key. What am I doing wrong? Is there a better way to do this? Thanks in advance.

Original source