I have two kinds of users in my application - clients and sellers. I am using a PhaseListener in JSF to prevent users from accessing pages without logging in, but a
Use Filter for this. Create class which implements javax.servlet.Filter interface and in doFilter() method check the role of user and if the user doesn't have role redirect him to some custom page. In web.xml add definition and mapping for this filter: