How to programmatically access requestScope objects
587515Oct 20 2009 — edited Oct 20 2009Hi all,
in the backing bean of a page I set some request attributes using the following code:
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
request.setAttribute(<key string>,<MyCustomObject>);
and then I navigate to another page. In this page I fill in some input text fields using EL expressions, like #{requestScope.<key string>.<property from MyCustomObject>}.
However when inside the backing bean of this page, i try to programmatically access the requestScope using:
FacesContext context = FacesContext.getCurrentInstance();
<MyCustomObjectClass> var = <MyCustomObjectClass>context.getExternalContext().getRequestMap().get(<key string>);
I get the code return null.
What can I have done wrong that my code does not return the objects I pass through the requestScope while the EL expressions work?