単一のページに多くの c:set 宣言を設定しました。また、roleId をセッションとして設定しました。他の c:set を作成すると、セッションの roleId が影響を受けました。私のページに私のセッションIDを表示したので、これを確認しました。ログイン後のセッション ID は正しかったのですが、ページを更新するとセッション ID が変わります。なぜ?ここに私のコードがあります
<%@page import="request.RequestDAO"%>
<%@page import="request.RequestItems"%>
<%@include file="/WEB-INF/common/taglibs.jsp"%>
<%@ page import="message.MessageItems"%>
<%@ page import="message.NewMessageDAO"%>
<div id="menu-wrapper">
<div id="menu">
<span class="menu-header">Calendar</span>
<div id="adminCalendar"></div>
</div>
<div id="menu">
<span class="menu-header">Directories <%=((Long) session.getAttribute("role")).longValue()%> </span>
<ul>
<li><a href="${pageContext.request.contextPath}/directory/list-of-registered-organizations">Organization </a></li>
<li><a href="${pageContext.request.contextPath}/directory/list-of-registered-medical-service">Medical Service</a></li>
<li><a href="${pageContext.request.contextPath}/directory/list-of-registered-evacuation-center">Evacuation Centers</a></li>
<li><a href="${pageContext.request.contextPath}/directory/list-of-registered-fire-suppression-group">Fire Suppression Groups</a></li>
<li><a href="${pageContext.request.contextPath}/directory/list-of-registered-medical-facilities">Medical Facilities</a></li>
<li><a href="${pageContext.request.contextPath}/directory/list-of-registered-rescue-organization">Rescue Organizations</a></li>
<li><a href="${pageContext.request.contextPath}/directory/list-of-registered-agency">Agency</a></li>
<li><a href="${pageContext.request.contextPath}/directory/list-of-registered-schools">Schools</a></li>
</ul>
</div>
<c:set var="admin" scope="session" value='<%=((Long) session.getAttribute("role")).longValue()%>' />
<c:if test="${admin == 121}">
<div id="menu">
<span class="menu-header">Registration</span>
<ul>
<li><a href="${pageContext.request.contextPath}/registration/organization-registry">Organization Registry </a></li>
<li><a href="${pageContext.request.contextPath}/registration/emergency-medical-service">Emergency Medical Service Registry</a></li>
<li><a href="${pageContext.request.contextPath}/registration/register-evacuation-center">Evacuation Centers Registry</a></li>
<li><a href="${pageContext.request.contextPath}/registration/register-fire-suppression-group">Fire Suppression Group Registry</a></li>
<li><a href="${pageContext.request.contextPath}/registration/register-medical-facilities">Medical Facilities Registry</a></li>
<li><a href="${pageContext.request.contextPath}/registration/register-rescue-organizations">Rescue Organizations Registry</a></li>
<li><a href="${pageContext.request.contextPath}/registration/agency-registration">Agency Registry</a></li>
<li><a href="${pageContext.request.contextPath}/registration/school-registration">School Registry</a></li>
</ul>
</div>
</c:if>
<%
long id = ((Long) session.getAttribute("userId")).longValue();
MessageItems message = new NewMessageDAO().NewMessages(id);
RequestItems NewRequest = new RequestDAO().NewRequests(id);
%>
<div id="menu">
<span class="menu-header">User Option</span>
<ul>
<li><a href="${pageContext.request.contextPath}/registration/organization-registry">My Account</a></li>
<li><a href="${pageContext.request.contextPath}/registration/emergency-medical-service">Change Password</a></li>
<li><a href="${pageContext.request.contextPath}/message/inbox">My Messages
<c:set var="role" scope="session" value='<%=message.getNewMessages()%>' />
<c:if test="${role == 0}">
<li><a href="${pageContext.request.contextPath}/message/inbox">My Messages<label></label></a></li>
</c:if>
<c:if test="${role != 0}">
<li style="font-weight: bold"><a href="${pageContext.request.contextPath}/message/inbox">My Messages <label>(<%=message.getNewMessages()%>)
</label></a></li>
</c:if>
<li><a href="${pageContext.request.contextPath}/message/new-message">Send Message</a></li>
<c:set var="role1" scope="session" value='<%=NewRequest.getNewRequest()%>' />
<c:if test="${role1 == 0}">
<li><a href="${pageContext.request.contextPath}/request/request-inbox">My Requests<label></label></a></li>
</c:if>
<c:if test="${role1 != 0}">
<li style="font-weight: bold"><a href="${pageContext.request.contextPath}/request/request-inbox">My Requests <label>(<%=NewRequest.getNewRequest()%>)
</label></a></li>
</c:if>
<li><a href="${pageContext.request.contextPath}/request/new-request">Make Request</a></li>
<li><a href="${pageContext.request.contextPath}/request/request-inbox">My Requests</a></li>
<li><a href="${pageContext.request.contextPath}/action/add-user">Add user</a></li>
<li><a href="${pageContext.request.contextPath}/action/view-all-user">View user</a></li>
</ul>
</div>
</div>