<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import = "java.net.URLEncoder" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style>
</style>
</head>
<body>
<!--
#쿠키 값 변경하기
1. 쿠키를 가져온다.
2. 쿠키가 있으면
3. 쿠키중에서 원하는 이름을 찾는다.
4. 쿠키를 변경해서 저장한다.
-->
<%
Cookie[] cookies = request.getCookies();
if(cookies != null && cookies.length > 0){
for(int i=0;i<cookies.length;i++){
if(cookies[i].getName().equals("name")){
Cookie cookie = new Cookie("name",URLEncoder.encode("JSP프로그래밍","utf8"));
response.addCookie(cookie);
}
}
}
%>
</body>
</html>