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
You may check session to know whether one is logged in or not (if you are using session to manage login information). Assuming you stored user information with the key user,here is an example:
<%
String page = "login.jsp";
String linkName = "Login";
if (session.getAttribute("user") != null) {
page = "logout.jsp";
linkName = "Logout";
}
%>
<%=linkName %>