There is a requirement where I need to do some update in the backing bean before exit the browser. Unfortunately JSF doesn't have such event handling for me. Googling around doesn't seems much help, thus I choose to use the dirty way by simulating a click event to trigger the function called in backing bean when unload event is invoke.
Here is the code:
- Put a commandLink in hidden form and execute the click simulation in JavaScript when page is unload.
- When the unload event is invoked, click event is triggered, and doCloseProcess will get trigger.
- Update the necessary stuff there then done.
No comments:
Post a Comment