세션 전체 조회

Seon Kim·2024년 10월 4일

session 전체 조회
// 세션에 저장된 모든 속성 이름 조회
Enumeration attributeNames = session.getAttributeNames();

// 세션에 저장된 값 출력
while (attributeNames.hasMoreElements()) {
String attributeName = attributeNames.nextElement(); // 속성 이름
Object attributeValue = session.getAttribute(attributeName); // 해당 속성의 값

// 속성 이름과 값 출력
System.out.println(attributeName + ": " + attributeValue);

}

profile
개발 어린이

0개의 댓글