aspose file tools*
The moose likes JSF and the fly likes Save option when user tries to navigate to other page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Save option when user tries to navigate to other page" Watch "Save option when user tries to navigate to other page" New topic
Author

Save option when user tries to navigate to other page

Singhna Saman
Greenhorn

Joined: Sep 06, 2010
Posts: 2
I have tried to look up the solution to this problem couldn't find any. Well I need to implement a feature that basically tracks when the user tries to navigate to another url. Supposing a user is at some page

http://localhost/myApp/page1.faces

and works on something and then goes to another link that points to

http://localhost/myApp/anotherPage1.faces

At this point i need to take control and check if any changes has been done to page1.faces and if so alert user to save the state before moving forward.
I am looking for any suggestions on how to carry this out using jsf1.2
sreejith sreedharan
Greenhorn

Joined: Sep 06, 2010
Posts: 5
What you can do is :

Create a link in

call doUpdateCheck and check if page1.faces is updated or not on actionBean.

if updated reRender Div with some values that javascript can findOut on Update ,

and on afterUpdate -> call above callJs and check for update value true/false

if updated show warning.

This is one way to do this

Singhna Saman
Greenhorn

Joined: Sep 06, 2010
Posts: 2
Thanks for the reply. I will work as per your suggestion. Just another quick concern - can we call JavaScript from phaselistener implementation ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Save option when user tries to navigate to other page