Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

scopes

 
gary stines
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
gary stines
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic