File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 16020
    
  20

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refresh data in JSF page