Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

scopes

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic