<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<center>
<h2>회원가입</h2>
<form action="RequestJoinProc.jsp" method="post">
<table width="500" border="1">
<tr height="50">
<td width="150" align="center">아이디</td>
<td width="350" align="center">
<input type="text" name="id" size="40" placeholder="id를 넣으세요">
</td>
</tr>
<tr height="50">
<td width="150" align="center">패스워드</td>
<td width="350" align="center">
<input type="password" name="pw1" size="40" placeholder="password를 넣으세요">
</td>
</tr>
<tr height="50">
<td width="150" align="center">패스워드확인</td>
<td width="350" align="center">
<input type="password" name="pw2" size="40">
</td>
</tr>
<tr height="50">
<td width="150" align="center">이메일</td>
<td width="350" align="center">
<input type="email" name="email" size="40">
</td>
</tr>
<tr height="50">
<td width="150" align="center">전화번호</td>
<td width="350" align="center">
<input type="tel" name="tel" size="40">
</td>
</tr>
<tr height="50">
<td width="150" align="center">당신의 관심분야</td>
<td width="350" align="center">
<input type="checkbox" name="hobby" value="캠핑">캠핑
<input type="checkbox" name="hobby" value="등산">등산
<input type="checkbox" name="hobby" value="영화">영화
<input type="checkbox" name="hobby" value="독서">독서
</td>
</tr>
<tr height="50">
<td width="150" align="center">당신의 직업</td>
<td width="350" align="center">
<select name="job">
<option value="의사">의사</option>
<option value="변호사">변호사</option>
<option value="교사">교사</option>
<option value="기술사">기술사</option>
</select>
</td>
</tr>
<tr height="50">
<td width="150" align="center">당신의 연령대</td>
<td width="350" align="center">
<input type="radio" name="age" value="10">10대
<input type="radio" name="age" value="20">20대
<input type="radio" name="age" value="30">30대
<input type="radio" name="age" value="40">40대
</td>
</tr>
<tr height="50">
<td width="150" align="center">하고싶은 말</td>
<td width="350" align="center">
<textarea rows="5" cols="40" name="info"></textarea>
</td>
</tr>
<tr height="50">
<td align="center" colspan="2">
<input type="submit" value="회원 가입">
<input type="reset" value="초기화">
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
<%@page import="java.util.Arrays"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<center>
<h2>회원 정보 보기</h2>
<%
//한글 깨짐 방지
request.setCharacterEncoding("UTF-8");
String id = request.getParameter("id");
String pw1 = request.getParameter("pw1");
String pw2 = request.getParameter("pw2");
String email = request.getParameter("email");
String tel = request.getParameter("tel");
//[] 타입으로 리턴
String[] hobby = request.getParameterValues("hobby");
String job = request.getParameter("job");
String age = request.getParameter("age");
String info = request.getParameter("info");
if(!pw1.equals(pw2)){
%>
<script type="text/javascript">
alert("비밀번호가 동일하지 않습니다");
history.go(-1);//이전페이지로 이동
</script>
<%
}
%>
<table width="400" border="1">
<tr height="50">
<td width="150" align="center">아이디</td>
<td width="350" align="center"><%= id %></td>
</tr>
<tr height="50">
<td width="150" align="center">이메일</td>
<td width="350" align="center"><%= email %></td>
</tr>
<tr height="50">
<td width="150" align="center">전화번호</td>
<td width="350" align="center"><%= tel %></td>
</tr>
<tr height="50">
<td width="150" align="center">관심분야</td>
<td width="350" align="center"><%= Arrays.toString(hobby) %></td>
</tr>
<tr height="50">
<td width="150" align="center">직업</td>
<td width="350" align="center"><%= job %></td>
</tr>
<tr height="50">
<td width="150" align="center">연령</td>
<td width="350" align="center"><%= age %></td>
</tr>
<tr height="50">
<td width="150" align="center">하고싶은 말</td>
<td width="350" align="center"><%= info %></td>
</tr>
</table>
</center>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<center>
<h2>로그인 페이지</h2>
<form action="ResponseLoginProc.jsp" method="post">
<table width="500" border="1">
<tr height="50">
<td width="150" align="center">아이디</td>
<td width="350" align="center">
<input type="text" name="id" size="40">
</td>
</tr>
<tr height="50">
<td width="150" align="center">패스워드</td>
<td width="350" align="center">
<input type="password" name="pw" size="40">
</td>
</tr>
<tr height="50">
<td align="center" colspan="2">
<input type="submit" value="로그인">
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h2> 로그인 처리 페이지 </h2> <!-- sendRedirect()를 만나면서 소멸 -->
<%
request.setCharacterEncoding("EUC-KR");
//임의적으로 id와 pw 설정
String dbId = "aaaa";
String dbPw = "1234";
//사용자로부터 넘어온 데이터
String id = request.getParameter("id");
String pw = request.getParameter("pw");
if(dbId.equals(id) && dbPw.equals(pw)){
//아이디와 패스워드가 일치하면 메인페이지로 이동
response.sendRedirect("ResponseMain.jsp?id=" + id);
}else {
%>
<script>
alert("아이디와 패스워드가 일치하지 않습니다.");
history.go(-1);
</script>
<%
}
%>
</body>
</html>