회원 탈퇴와 수정에서 사용하는 id는 session에서 가져와야 한다.
-- 회원탈퇴
update member
set mlevel='F1'
where id=? and passwd=?;
-- 회원 정보 수정
--1) 수정하고자 하는 행을 가져오기 -> read()함수
select mname, tel, email, zipcode, address1, address2, job
from member
where id=?
--2) 새로 입력한 값으로 행 수정하기 -> modifyProc() 함수
-- (id는 수정불가, mlevel은 사이트운영자가 수정, mdate는 수정안함) 날짜는 최초등록일, 최종수정일 이렇게 운영하기도함
update member
set passwd=?, mname=?, tel=?, email=?, zipcode=?, address1=?, address2=?, job=?
where id=?
memberWithdraw.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="../header.jsp"%>
<!-- 본문 시작 memberWithdraw.jsp-->
<h3>* 회원탈퇴 *</h3>
<form method="post" action="memberWithdraw.jsp" onsubmit="return pwCheck()"> <!-- myscript.js -->
<table class="table">
<tr>
<th class="success">비밀번호</th>
<td><input type="password" name="passwd" id="passwd" required></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="회원탈퇴" class="btn btn-danger">
</td>
</tr>
</table>
</form>
<!-- 본문 끝 -->
<%@ include file="../footer.jsp"%>
memberWithdrawProc.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="ssi.jsp"%>
<%@ include file="../header.jsp"%>
<!-- 본문 시작 memberWithdrawProc.jsp-->
<h3>* 회원탈퇴 결과 *</h3>
<%
dto.setId((String)session.getAttribute("s_id"));
dto.setPasswd(request.getParameter("passwd").trim());
int cnt = dao.memberWithdraw(dto);
if(cnt==0){
out.println("<p>비밀번호가 일치하지 않습니다</p>");
out.println("<p><a href='javascript:history.back()'>[다시시도]</a></p>");
} else {
String message="";
message += "회원 탈퇴 되었습니다.\\n이용해주셔서 감사합니다.";
message += "재가입을 원할 경우 이메일로 문의하시기 바랍니다.";
out.println("<script>");
out.println(" alert('" + message + "');");
out.println(" location.href='loginForm.jsp';"); //목록페이지 이동
out.println("</script>");
}//if end
%>
<!-- 본문 끝 -->
<%@ include file="../footer.jsp"%>
이렇게 id는 session을 통해 가져온다.
이제 나머지 구현하는 것은 각자 해보자
'웹개발 교육 > jsp' 카테고리의 다른 글
[63일] jsp (41) - MVC (0) | 2022.10.26 |
---|---|
[62일] jsp (40) - myweb 프로젝트(호스팅) (0) | 2022.10.25 |
[61일] jsp (38) - myweb 프로젝트(과제) (0) | 2022.10.24 |
[61일] jsp (37) - myweb 프로젝트(첨부 게시판-삭제) (0) | 2022.10.24 |
[60일] jsp (36) - myweb 프로젝트(첨부 게시판-목록, 상세보기) (0) | 2022.10.21 |