해당 게시물은 Udemy의 "JSP, Servlets and JDBC for Beginners" 강의를 정리한 내용입니다. 영어를 한국어로 번역하는 과정에서 잘못된 부분이 있을 수 있습니다.
This post summarizes Udemy's "JSP, Servlets and JDBC for Beginners" lecture.

session.setAttribute(String name, Object value)
<!--리스트를 세션에 추가하고 싶을 때 -->
List<String> items = new ArrayList<>();
session.setAttribute("myToDoList", items);
Object session.getAttribute(String name)
List<String> mystuff = (List<String>) session.getAttribute("myToDoList");
| 메소드 | 설명 |
|---|---|
| isNew() : boolean | 만약 새로운 세션일 경우 true 리턴 |
| getId() : String | 세션 ID를 리턴 |
| invalidate() : void | 세션 객체를 없애고 싶을 때 세션을 무효화하고, 해당 세션과 관련된 모든 객체를 unbind ex. logout 할 때 |
| setMaxInactiveInterval(long mills) : void | 세션이 만료되는 idle time을 설정한다. 값은 밀리초 단위로 제공한다. Tomcat의 비활성 간격은 30분이지만, 서버에 따라 상이하다. ex. 온라인 뱅킹 시, 은행은 보통 5분으로 설정 |