How to use FacesContext.getCurrentInstance(), it returns null
问题 I've been struggling for the last couple of days with the login part of my web app. I've gotten to the point where I can succesfully authenticate a user using the JDBCRealm on tomcat(by reading users from a sql server database). Now I want to send some kind of feedback when the user's account has been blocked, or when the credentials are incorrect, this is where I'm stuck now. I wanted to use this: try { request.login(request.getParameter("user"), request.getParameter("pass")); } catch