자바 스프링에서 세션의 값을 사용해서 저장할 때 컨트롤러에서 이렇게 사용하면 됨 //HttpSession이어야 함(넣기) public String example(HttpSession session){ session.setAttribute( "sessionId" , 12 ); return "example" ; } //꺼내기 public String exampleReceive(Model model, Eligibility eligibility, HttpSession session) { if (session.getAttribute( "sessionId" ) = = null ){ return "redirect:/bye" ; } else { int sessionId = ( int )session.getAttribute( "sessionId" ); //세션 개별 삭제 session.removeAttribute( "sessionId" ); //세션 전체 제거 session.invalidate(); // 세션 유지시간 설정(초단위) // 60 * 30 = 30분 session.setMaxInactiveInterval( 30 * 60 ); // 세션 시간을 무한대로 설정 session.setMaxInactiveInterval( - 1 ); return "/exampleReceive" ; } } Colored by Color Scripter cs 출처 : https://devuna.tistory.com/53