JSF: How to redirect a user to a another page according to the value of a specific FacesContext session attribute
问题 In my JSF application, I need to redirect the user from Page A to page B if a session attribute such as userRole has a value of "contributor", and to a page C, for example, if it is "author". I'm told that I have to implement a page listener, or a session listener perhaps. Although I understand writing a listener class is quite straightforward and standard, I don't know how to set it up on the JSF page itself (to listen to the session). Anybody? 回答1: A session listener (HttpSessionListener)