JSP/COOKIE
chapter02 : cookie_view
GAWON
2023. 5. 24. 09:16
<%@page import="java.net.URLDecoder"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
// 쿠키 저장소의 모든 데이터 확인하기
Cookie[] cookiebox = request.getCookies();
if(cookiebox != null && cookiebox.length > 0){
for(int i=0; i<cookiebox.length; i++){
out.print("쿠키 이름 : " +cookiebox[i].getName() + "<br>");
out.print("쿠키 값 : " + URLDecoder.decode(cookiebox[i].getValue(), "utf-8")
+ "<br>");
}
}else{
out.print("쿠키가 존재하지 않습니다");
}
%>
</body>
</html>