728x90
반응형
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%--src/main/webapp/medel1/member/pwForm.jsp --%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>비밀번호찾기</title>
<link rel="stylesheet" href="../../css/main.css">
</head><body><h3>비밀번호찾기</h3>
<form action="pw.jsp" method="post">
<table>
<tr><th>아이디</th><td><input type="text" name="id"></td></tr>
<tr><th>이메일</th><td><input type="text" name="email"></td></tr>
<tr><th>전화번호</th><td><input type="text" name="tel"></td></tr>
<tr><td colspan="2"><input type="submit" value="비밀번호찾기"></td></tr>
</table>
</form></body></html>
<%@page import="model.MemberDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%-- src/main/webapp/model1/member/pw.jsp --%>
<%--
1. 파라미터 저장.
2. db에서 id,email과 tel 을 이용하여 pass값을 리턴
pass = MemberDao.pwSearch(id,email,tel)
3. pw 값이 존재
화면에 앞 두자리는 **로 표시하여 화면에 출력. 닫기버튼 클릭시 현재 화면 닫기
4. pw 값이 없는 경우
정보에 맞는 비밀번호를 찾을 수 없습니다. 메세지 출력후
pwForm.jsp로 페이지 이동.
--%>
<%
String id = request.getParameter("id");
String email = request.getParameter("email");
String tel = request.getParameter("tel");
MemberDao dao = new MemberDao();
String pass = dao.pwSearch(id,email,tel);
if (pass != null) {
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>비밀번호 찾기</title>
</head>
<body>
<link rel="stylesheet" href="../../css/main.css">
<script type="text/javascript">
function pwsend(pw) {
opener.document.f.pass.value=pass;
self.close();
}
</script>
</head>
<body>
<table>
<tr>
<th>비밀번호</th>
<td><%="**" + pass.substring(2, pass.length())%></td>
</tr>
</table>
</body>
</html>
<% } else { %>
<script>
alert("정보에 맞는 비밀번호를 찾을 수 없습니다.");
location.href="pwForm.jsp";
</script>
<% } %>
728x90
반응형
'study > MVC' 카테고리의 다른 글
[MVC] 18. MVC Model2방식 - 회원가입 (로그인 만들기) (0) | 2022.04.14 |
---|---|
[MVC] 16. MVC Model1 방식 - 회원가입 (비밀번호변경) (0) | 2022.04.12 |
[MVC] 16. MVC Model1 방식 - 회원가입 (아이디찾기) (0) | 2022.04.12 |
[MVC] 16. MVC Model1 방식 - 회원가입 (회원사진등록) (0) | 2022.04.11 |
[MVC] 16. MVC Model1 방식 - 회원가입 (파일업로드) (0) | 2022.04.11 |