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

Refresh data in JSF page

 
Minh Phuc
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 pages. The page 1 will transfer some data into page 2 so i have to use session scoped for bean in page 1. In page 2, i have to change some data which will influence data in page 1. But i go back page 1, the data is still not change. If i use View scope in page 1 i cannot transfer into page 2. Please help me do!
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Minh!

SInce bean1 seems to be the base bean for this workflow and bean2 is a modifier of it, the easiest way to handle that is to inject bean1 into bean2 and let the bean2 page do what it needs, passing the results back to the injected bean1. In a case like that, putting bean2 in View scope should work, and probably you'll want a @PostConstruct method to pre-configure bean2 based on bean1's properties. For older systems where @PostConstruct didn't work, we had to kind of hack things, since there was no clear method call for the time where the managed properties were all set but nothing was yet being fetched for display.

In some cases, you need a more permanent connection running both ways. In that case, make both beans be session scoped, inject bean2 into bean1 and code the bean2 to set itself into the bean1 using a "setBean2" method that you add to bean1. You would probably do this in the bean2 "setBean1 method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic