Reputation: 339
I have stored the Usertype in the session. It is printing hello, Admin! when i'm using <%= session.getAttribute( "Usertype" ) %> but not showing the menu options with
<p>hello, <%= session.getAttribute( "Usertype" ) %></p>
<c:set scope="session" var="Usertype" value="${param.Usertype}" />
<c:choose>
<c:when test="${Usertype == 'Employee'}">
<div class="nav">
<ul><li class="container"><img src="${pageContext.request.contextPath}/images/enabling.jpg" /></li>
<li class="current"><a href="daywise.jsp">DayWise TimeSheet</a></li>
<li><a href="timesheet.jsp">Weekly TimeSheet</a></li>
</ul>
</div>
</c:when>
<c:when test="${Usertype == 'Manager'}">
<div class="nav">
<ul><li class="container"><img src="${pageContext.request.contextPath}/images/enabling.jpg" /></li>
<li class="current"><a href="daywise.jsp">DayWise TimeSheet</a></li>
<li><a href="timesheet.jsp">Weekly TimeSheet</a></li>
<li><a href="newemployee.jsp">Add New Employeer</a></li>
<li><a href="retrieve.jsp">Retrieve TimeSheet</a></li>
</ul>
</div>
</c:when>
<c:when test="${Usertype == 'Admin'}">
<div class="nav">
<ul><li class="container"><img src="${pageContext.request.contextPath}/images/enabling.jpg" /></li>
<li class="current"><a href="daywise.jsp">DayWise TimeSheet</a></li>
<li><a href="timesheet.jsp">Weekly TimeSheet</a></li>
<li><a href="newemployee.jsp">Add New Employeer</a></li>
<li><a href="retrieve.jsp">Retrieve TimeSheet</a></li>
</ul>
</div>
</c:when>
Upvotes: 0
Views: 396
Reputation: 5533
You should access like this ${sessionScope.Usertype} to get values from session
Upvotes: 1