It's not a secret anymore!*
The moose likes JSF and the fly likes scopes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "scopes" Watch "scopes" New topic
Author

scopes

gary stines
Greenhorn

Joined: Mar 11, 2002
Posts: 19
I have a page with a request scoped backing bean. One of the input parameters on this first page is created by navigating to another page. After leaving the second page I would like to return to the first page displaying its new value in the input field.

How can this be done leaving the first page backing bean in the request scope.

I could set the backing bean on the first page as session scope, but I would have to initialise the bean every time I navigate to that page.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

At the very least, that value would have to be in the session. Everytime you navigate a new request is created, thereby creating a new backing bean. This is just basic J2EE. JSF handles repopulating values when a request doesn't navigate from the page. For example, when you press a button that uses the actionListener attribute, JSF knows that even though the scope is request, it needs to save the values and repopulate the backing bean accordingly because you aren't navigating away from the page.


GenRocket - Experts at Building Test Data
gary stines
Greenhorn

Joined: Mar 11, 2002
Posts: 19
I know I probably had to use some session scoped object, I guess what I was really asking are what best practices/patterns others are using.

Could a pop window be used? This should leave the initial screen and its values intact.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: scopes