Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post render event handler in JSF 2?

Tags:

jquery

jsf-2

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??

like image 970
user1220373 Avatar asked Feb 11 '26 05:02

user1220373


1 Answers

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.

like image 74
1337 Avatar answered Feb 16 '26 17:02

1337



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!