I want do display a login link when the user isn\'t logged in and a logout link when the user is logged in. I\'m using container managed security as defined in web.xml
The username of the logged-in user is available by ExternalContext#getRemoteUser() which delegates under the covers to HttpServletRequest#getRemoteUser(). Both are available in EL by #{facesContext.externalContext.remoteUser} and #{request.remoteUser} respectively. If it is null, then it means that the user is not logged in.
So, in your view you can check it in the rendered attribute as follows: