Web07_JSP
12_cookie_practice_input.jsp
Krystalism_
2020. 11. 12. 18:10
12_cookie_practice_input.jsp
0.00MB
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% Cookie[] cookies = request.getCookies(); String id = ""; String pw = ""; if(cookies != null){ for(Cookie cookie: cookies){ if(cookie.getName().equals("id")){ // 쿠키의 key 이름이 "id"인 경우 id = cookie.getValue(); } else if(cookie.getName().equals("pw")){//쿠키의 key 이름이 "pw" pw = cookie.getValue(); } } } %>