java - JSTL Reading if session value is set not working properly -
i'm making testing , have faced strange problem, i'm setting session on servlet:
sessions.setattribute("logged_in", "true");
this code on jstl page, want check if session name "logged_in" set
<c:choose> <c:when test="${not empty sessionscope.logged_in}"> <a href="/logout">logout</a> </c:when> <c:otherwise> <a href="/login">login</a> </c:otherwise> </c:choose>
but when check website, outputs:
<a href="/logout">logout</a> <a href="/login">login</a>
it should output login or logout, not both. idea might wrong here?
look's tags not executed server.
have added jstl
jars in library , added <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
in jsp?
Comments
Post a Comment