header.jsp

<c:choose>
	<c:when test="${empty principal}"> // -> 로그아웃상태
		<li class="nav-item"><a class="nav-link" href="${cp}/user?cmd=joinForm">회원가입</a></li>
		<li class="nav-item"><a class="nav-link" href="${cp}/user?cmd=loginForm">로그인</a></li>
	</c:when>
	<c:otherwise> // -> 로그인 상태
		<li class="nav-item"><a class="nav-link" href="${cp}/board?cmd=saveForm">글쓰기</a></li>
		<li class="nav-item"><a class="nav-link" href="${cp}/user?cmd=updateForm">회원정보변경</a></li>
		<li class="nav-item"><a class="nav-link" href="**${cp}/user?cmd=logout">로그아웃**</a></li>
	</c:otherwise>
</c:choose>

UserController.java

else if(cmd.equals("logout")) {
			return new LogoutAction();
		}

LogoutAction.java

public class LogoutAction implements Action{

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		session.invalidate(); // -> 세션무효화 코드라고 말해줬찌
		
		response.sendRedirect("/blog");
		
	}

}

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/3413eebf-5437-4382-b0f5-a71096ad57cb/Untitled.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/256e1ed4-4a43-4a37-88d3-33a9aeae5717/Untitled.png

principal 이 empty 이기 때문에

header.jsp

의 아래 부분이 실행된 것이야

<c:when test="${empty principal}"> // -> 로그아웃상태
		<li class="nav-item"><a class="nav-link" href="${cp}/user?cmd=joinForm">회원가입</a></li>
		<li class="nav-item"><a class="nav-link" href="${cp}/user?cmd=loginForm">로그인</a></li>
	</c:when>