jsp

2022_11_30 RESPONSE 02 <STYLE> EX

0304호 2022. 11. 30.

HTML style 태그 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>res_ex02</title>

	<style>
		.container{
			display: flex;					/*  */
			height:100vh;					/*  */
			background-color: lightgrey;	/* 백그라운드 색상 */
			justify-content: center;		/* 중앙에 콘넽츠 위치 */
			align-items: center;			/*  */
		}
		
		#wrap{
			border: 1px solid #777;			/* border두깨 */
			background-color: #ffffff;		/* 백그라운드 색상 */
			padding: 10px;					/* 여백 */
			text-align: center;				/* 글자 정렬 */
			font-size: 15px; 
		}
	
	</style>

</head>
<body>

	<!-- 
		태그의 class속성 - 식별할 수 있는(화면에서 중복 ㅇ)
		주로 디자인을 적용하는데 사용
		선택자 class는 .으로 나타내고 id는 #으로 지칭해서 나타냄
		
		태그의 id - 고유하게 식별하는 이름(화면에서 중복이 있으면 x)
	 -->

	<div class="container">
		<form action="res_ex02_result.jsp" method = "post" id="wrap">
			<h3>로그인 연습</h3>
			<input type="text" name="id" placeholder="아이디"><br>
			<input type="password" name="pw" placeholder="비밀번호"><br>
					
			<input type="submit" value="로그인">
		</form>	
	</div>
	


</body>
</html>

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
    <%
    request.setCharacterEncoding("utf-8");
    /*
    1. id pw를 받아서 처리합니다.
    2. id가 abc1234이고 비밀번호가 asd123 이라면 로그인 성공으로 간주하고 res_ex02_ok 리다이렉트
    3. id or pw가 틀린경우 res_ex02_no 페이지로 리다이렉트
    */
    
    String id = request.getParameter("id");
    String pw = request.getParameter("pw");
    
    if(id.equals("abc1234") && pw.equals("asd123")){
    	response.sendRedirect("res_ex02_ok.jsp");
    }else{
    	response.sendRedirect("res_ex02_no.jsp");
    }
    
    %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>res_ex02_result</title>
</head>
<body>



</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>res_ex02</title>
</head>
<body>
	<p>어서오세요</p><br>
	<a href="res_ex02.jsp"> 돌아가기</a>
	
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>res_ex02</title>
</head>
<body>
	아이디, 비밀번호를 확인하세요<br>
	<a href="res_ex02.jsp"> 돌아가기</a>

</body>
</html>

'jsp' 카테고리의 다른 글

2022_11_30 Cookie_02  (0) 2022.11.30
2022_11_30 Cookie 쿠키  (0) 2022.11.30
2022_11_30 RESPONSE 01  (0) 2022.11.30
2022_11_30 REQUEST 학생번호 예제  (0) 2022.11.30
2022_11_30 jsp REQUEST 연습 BMI계산기  (0) 2022.11.30

댓글