This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Refresh data in JSF page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Refresh data in JSF page" Watch "Refresh data in JSF page" New topic
Author

Refresh data in JSF page

Minh Phuc
Greenhorn

Joined: Aug 07, 2012
Posts: 9
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

Joined: Jun 25, 2001
Posts: 15960
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
jQuery in Action, 2nd edition
 
subject: Refresh data in JSF page
 
Similar Threads
How to achieve secured data transfer through FTPS/SFTP
IE vs Mozilla + Java script code
can anyone please give me an example for using value objects in struts
JSP- Servlet communication
Can javascript files shared variables across multiple instances of an application