Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to programmatically access requestScope objects

587515Oct 20 2009 — edited Oct 20 2009
Hi 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?
This post has been answered by Sireesha Pinninti-Oracle on Oct 20 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 17 2009
Added on Oct 20 2009
2 comments
1,217 views