Is there a way to call a method upon leaving a page with JSF?
You can call a JSF managed bean method when you are closing the page or navigating to another page by using a and calling it at 'onunload' event of the page body as below.