Software Development

JSF – Check If User is Logged In with preRenderView

This post demonstrates how to check if user is logged in before a restricted page is displayed to the user.



Stuff used in this post.

  • JSF 2.2
    • javax.faces-2.2.8.jar
  • JDK 8

Using Event preRenderView

preRenderView is a system event that can be used to perform pre-processing before the a JSF page is displayed. For example, the following codes use preRenderView and invokes a managed bean method to perform a simple validation check.


myBean.isLoggedIn method has these codes:


ConfigurableNavigationHandler is used to “forward” the user to another page.


Download the codes


Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.

You Might Also Like