addCookie.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%
Cookie cookie = new Cookie("id", "smhrd");
response.addCookie(cookie);
response.sendRedirect("checkCookie.jsp");
%>
</body>
</html>
checkCookie.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
${cookie.id.value}님 환영합니다!
</body>
</html>
'Programming > Servlet & JSP' 카테고리의 다른 글
게시판(FileUpload) (0) | 2020.02.24 |
---|---|
JSTL 연습하기 (0) | 2020.02.24 |
체크박스 EL식으로 값 가져오기 (0) | 2020.02.23 |
EL 연습하기 (0) | 2020.02.23 |
url option (0) | 2020.02.23 |