본문 바로가기
웹프로그래밍/JSP

쿠키 로그인

by 폴더맨 2024. 6. 8.

쿠키 로그인1

<%@ page contentType="text/html; charset=EUC-KR"%>

<html>
<head>
<TITLE>로그인 화면</TITLE>
</HEAD>
<BODY>
	<form action="8-9.jsp" method="post">
		아이디 <input type="text" name="id"><br> 
		비밀번호 <input 	type="password" name="pw"><br> 
		<input type="submit" value="확인">
	</form>
</BODY>
</HTML>

 

쿠키 로그인2

<%@ page contentType="text/html; charset=EUC-KR" %>

<html>
<head>
<TITLE>로그인 처리 화면</TITLE>
</head>
<body>
<%
   String id = request.getParameter("id");
   String pw = request.getParameter("pw");
   if(id.equals("admin") && pw.equals("pass")) {
      Cookie cookie = new Cookie("ID", "ADMIN");
      response.addCookie(cookie);
      out.print("<h2>로그인 성공</h2>");
   } else {
      out.print("<h2>로그인 실패</h2>");
   }
%>
<h3><a href="8-10.jsp">로그인 확인</a></h3>
</body>
</html>

 

 

세상을 링크하라!!! 모든 링크를 한 자리에...
링크닷컴: https://linkdotcom.mycafe24.com/

 

유용한 링크, 링크닷컴 #무료 #링크사이트 #링크사이트

컴퓨터 및 일반 유용한 링크들을 모아 놓았습니다. 지금 바로 확인하세요!

linkdotcom.mycafe24.com

 

 

 

'웹프로그래밍 > JSP' 카테고리의 다른 글

쿠키 로그아웃  (0) 2024.06.08
쿠키 로그인여부  (0) 2024.06.08
현재 쿠키  (0) 2024.06.08
쿠키 확인  (0) 2024.06.08
쿠키 변경  (0) 2024.06.08