본문 바로가기
웹프로그래밍/JSP

세션

by 폴더맨 2024. 6. 8.

세션

<%@ page contentType="text/html; charset=EUC-KR" %>
<%@ page session = "true" %>
<%@ page import = "java.util.Date, java.text.SimpleDateFormat" %>
<html>
<head>
<title>생성된 세션 정보 출력하기</title>
</head>
<body>
<%
   Date c_time = new Date(), m_time = new Date();
   SimpleDateFormat formatter = 
          new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
   c_time.setTime(session.getCreationTime( ));
   m_time.setTime(session.getLastAccessedTime( ));
%>
<H3>
세션 아이디 : <%= session.getId( ) %><br>
세션 생성 시각 : <%= formatter.format(c_time) %> <br>
세션 최종 접근 시각 : <%= formatter.format(m_time) %> <br>
</H3>
</body>
</html>

'웹프로그래밍 > JSP' 카테고리의 다른 글

세션 삭제  (0) 2024.06.08
세션 설정  (0) 2024.06.08
쿠키 로그아웃  (0) 2024.06.08
쿠키 로그인여부  (0) 2024.06.08
쿠키 로그인  (0) 2024.06.08