<%
Boolean loggedIn = (Boolean)session.getAttribute("login");
System.out.println("loggedIn is " + loggedIn);
%>
<header>
<% System.out.println("loggedIn is now " + loggedIn); %>
<c:choose>
<c:when test="${loggedIn}">
<a href="#"> My Profile </a>
</c:when>
<c:otherwise>
<a href="#"> Sign In </a>
</c:otherwise>
</c:choose>
</header>
This is a JSPF for a project that I have made. The output for the following is
loggedIn is true
loggedIn is now true
Despite this, my actual page always shows "Sign in" and never shows "My Profile". Also, when I change the condition to
<c:when test="${not loggedIn}">
It begins to display "My Profile". I do not get how loggedIn can be true and yet fail this statement.
Thankyou.