JSP 3일차 Cookie 테스트

<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Cookie Test</title>
</head>
<body>

<%
Cookie cookie = new Cookie("jwnamkung","SamsungSDS");
response.addCookie(cookie);
%>
name : <%= cookie.getName() %><br>
value : <%= cookie.getValue() %><br>

<br>

<%
Cookie[] cookies = request.getCookies();

if(cookies!=null && cookies.length>0)
{
for(int i=0; i<cookies.length; i++)
{
%>
name : <%= cookies[i].getName() %><br>
value : <%= cookies[i].getValue() %><br>
<%
}
}
%>

</body>
</html>

댓글 없음: