modify.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>수정 및 탈퇴</title>
</head>
<body>
<h1>수정 및 탈퇴 페이지</h1>
<h2>modify.jsp</h2>
<p>
<a href="updateForm.jsp">정보 수정</a>
<a href="deleteForm.jsp">회원 탈퇴</a>
</p>
</body>
</html>
updateForm.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"pageEncoding="EUC-KR"%>
<%@ page import = "bean.*" %>
<%@ page import = "ch11.logon.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>회원정보 수정</title>
</head>
<body>
<h1>회원정보 수정 페이지</h1>
<h2>updateForm.jsp</h2>
<%
String id = (String)session.getAttribute("memId");
MemberDAO dao = MemberDAO.getInstance();//manager
MemberDTO dto = dao.getMember(id); //c
try{
%>
<form name="updateform" action="updateMember.jsp" method="post" onSubmit="return checkIt()">
<table border="1">
<tr height="25">
<td colspan="2" bgcolor="#fffacd">계정정보 수정</td>
</tr>
<tr>
<td height="30">사용자 ID</td>
<td width="450">
<%=dto.getId()%>
</td>
</tr>
<tr>
<td height="30">비밀번호</td>
<td>
<input type="password" name="pw" size="15" maxlength="12" value="<%=dto.getPw()%>"></input>
</td>
</tr>
<tr>
<td height="30">비밀번호 확인</td>
<td>
<input type="password" name="pw2" size="15" maxlength="12" value=""></input>
</td>
</tr>
<tr height="25">
<td colspan="2" bgcolor="#fffacd">개인정보 수정</td>
</tr>
<tr>
<td height="30">이름</td>
<td>
<%=dto.getName()%>
</td>
</tr>
<tr>
<td height="30">생일</td>
<td>
<%=dto.getMonth() + " " + dto.getDay()%>
</td>
</tr>
<tr>
<td height="30">성별</td>
<td>
<%=dto.getSex()%>
</td>
</tr>
<tr>
<td height="30">전화번호</td>
<td>
<%if(dto.getTel()==null){%>
<input type="text" name="tel" size="40" maxlength="30" >
<%}else{%>
<input type="text" name="tel" size="40" maxlength="30" value="<%=dto.getTel()%>">
<%}%>
</td>
</tr>
<tr>
<td height="30">E-Mail</td>
<td>
<%if(dto.getEmail()==null){%>
<input type="text" name="email" size="40" maxlength="30" >
<%}else{%>
<input type="text" name="email" size="40" maxlength="30" value="<%=dto.getEmail()%>">
<%}%>
</td>
</tr>
</table>
<input type="submit" value="수정">
<input type="button" name="cancel" value="변경 취소" onclick="javascript:window.location='main.jsp'">
</form>
</body>
<%}catch(Exception e){}%>
<script language="JavaScript">
<!--
function checkIt(){
if(document.updateform.pw.value != document.updateform.pw2.value || document.updateform.pw.value=="" || document.updateform.pw2.value=="" ){
alert("joinform : 비밀번호를 동일하게 입력하세요.");
return false;
}
if(!document.updateform.tel.value){
alert("joinform : 전화번호를 입력하지 않으셨습니다.");
return false;
}
if(!document.updateform.email.value){
alert("joinform : 이메일을 입력하지 않으셨습니다.");
return false;
}
}
-->
</script>
</html>
updateMember.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"pageEncoding="EUC-KR"%>
<%@ page import = "bean.MemberDAO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>수정완료</title>
</head>
<body>
<h1>member update 페이지</h1>
<h2>updateMember.jsp</h2>
<% request.setCharacterEncoding("euc-kr");%>
<jsp:useBean id="dto" class="bean.MemberDTO">
<jsp:setProperty name="dto" property="*" />
</jsp:useBean>
<%
String id = (String)session.getAttribute("memId");
dto.setId(id);
MemberDAO dao = MemberDAO.getInstance();
dao.updateMember(dto);
//member = dto manager - dao
%>
<table width="270" border="1" cellspacing="0" cellpadding="5" align="center">
<tr>
<td height="39" align="center">
<font size="+1" ><b>회원정보가 수정되었습니다.</b></font>
</td>
</tr>
<tr>
<td align="center">
<p>입력하신 내용대로 수정이 완료되었습니다.</p>
</td>
</tr>
<tr>
<td align="center">
<form>
<input type="button" value="메인으로" onclick="window.location='main.jsp'">
</form>
5초후에 메인으로 이동합니다.
<meta http-equiv="Refresh" content="5;url=main.jsp" >
</td>
</tr>
</table>
</body>
</html>
deleteFrom.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>회원탈퇴</title>
</head>
<body onload="begin()">
<h1>회원탈퇴 페이지</h1>
<h2>deleteForm.jsp</h2>
<form name="deleteform" action="deleteMember.jsp" method="post" onSubmit="return checkIt()">
<TABLE cellSpacing=1 cellPadding=1 width="260" border=1 align="center" >
<TR height="30">
<TD colspan="2" align="middle">
<font size="+1" ><b>회원 탈퇴</b></font>
</TD>
</TR>
<TR height="30">
<TD width="110" align=center>비밀번호</TD>
<TD width="150" align=center>
<INPUT type=password name="pw" size="15" maxlength="12">
</TD>
</TR>
<TR height="30">
<TD colspan="2" align="middle">
<INPUT type="submit" value="탈퇴">
<input type="button" value="취소" onclick="javascript:window.location='main.jsp'">
</TD>
</TR>
</TABLE>
</form>
</body>
<script language="javascript">
<!--
function begin(){
document.deleteform.pw.focus();
}
function checkIt(){
if(!document.deleteform.pw.value){
alert("비밀번호를 입력하지 않으셨습니다.");
document.deleteform.pw.focus();
return false;
}
}
-->
</script>
</html>
deleteMember.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"pageEncoding="EUC-KR"%>
<%@ page import="bean.MemberDAO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>탈퇴 완료</title>
</head>
<body>
<h1>탈퇴 완료 페이지</h1>
<h2>deleteMember.jsp</h2>
<%
String id = (String)session.getAttribute("memId");
String pw = request.getParameter("pw");
//member = dto manager - dao
MemberDAO dao = MemberDAO.getInstance();
boolean check = dao.deleteMember(id, pw);
if(check==true){
session.invalidate();
%>
<form method="post" action="main.jsp" name="userinput" >
<table width="270" border="1" cellspacing="0" cellpadding="5" align="center">
<tr>
<td height="39" align="center">
<font size="+1" ><b>회원정보가 완전히 삭제되었습니다.</b></font></td>
</tr>
<tr>
<td align="center">
<p>잘가시오.</p>
<meta http-equiv="Refresh" content="5;url=main.jsp" >
</td>
</tr>
<tr>
<td align="center">
<input type="submit" value="확인">
</td>
</tr>
</table>
</form>
<%}else {%>
<script>
alert("비밀번호가 맞지 않습니다.");
history.go(-1);
</script>
<%}%>
</body>
</html>