Is there any event hadling mechanism in JSF 2 after a page has been rendered completely? I want to invalidate the session of a user once he reaches the last page of my application and the page has been rendered completely??
Have a look here: Link. Maybe you can try invalidating the session on event PreRenderComponentEvent (After a component has been rendered), although the name and description seem inconsistent.
If it does not work, you can try with the workaround by indirect navigation to your target page. Initialy you navigate to some dummy JSF page, which will invalidate the session (postconstruct method, or system event listener), then trigger the redirection to your target JSF page. Help for redirection. If you need this behaviour in several places, you can also generalize the intermediate JSF by passing the target page as a parameter.
EDIT: Have you tried invalidating the session in method annotated with @PreDestroy inside a RequestScoped bean? In case if it works: I am not sure if JSF guarantees to call the predestroy methods before the new request is made.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With