회원탈퇴 폼

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ include file="setting.jsp" %>    
<link type="text/css" rel="stylesheet" href="<%=project%>/member/style_member.css">    
<script src="<%=project%>/member/script.js"></script>   

<h2> <%=page_delete%> </h2>

<form method="post" name="passwdform" action="deletePro.jsp" onsubmit="return passwdcheck()">
	<table>
		<tr>
			<th colspan="2"> <%=msg_passwd%> </th>
		</tr>
		<tr>
			<th> <%=str_passwd%> </th>
			<td> <input class="input" type="password" name="passwd" maxlength="30" autofocus> </td>
		</tr>		 
		<tr>
			<th colspan="2">
				<input class="inputbutton" type="submit" value="<%=btn_del%>">		
				<input class="inputbutton" type="button" value="<%=btn_del_cancel%>"
					onclick="location='main.jsp'">		
			</th>
		</tr>
	</table>
</form>

회원탈퇴 폼

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ include file="setting.jsp" %>    
<link type="text/css" rel="stylesheet" href="<%=project%>/member/style_member.css">    
<script src="<%=project%>/member/script.js"></script>   

<h2> <%=page_delete%> </h2>

<form method="post" name="passwdform" action="deletePro.jsp" onsubmit="return passwdcheck()">
	<table>
		<tr>
			<th colspan="2"> <%=msg_passwd%> </th>
		</tr>
		<tr>
			<th> <%=str_passwd%> </th>
			<td> <input class="input" type="password" name="passwd" maxlength="30" autofocus> </td>
		</tr>		 
		<tr>
			<th colspan="2">
				<input class="inputbutton" type="submit" value="<%=btn_del%>">		
				<input class="inputbutton" type="button" value="<%=btn_del_cancel%>"
					onclick="location='main.jsp'">		
			</th>
		</tr>
	</table>
</form>

회원가입폼의 로직을 구현하는 deletePro.jsp

<%@page import="member.LogonDBBean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ include file="setting.jsp" %>    
<script src="<%=project%>/member/script.js"></script>   

<h2> <%=page_delete%> </h2>

<%
	String id = (String) session.getAttribute( "memId" );
	String passwd = request.getParameter( "passwd" );
%>
<%
	LogonDBBean dao = LogonDBBean.getInstance();
	int result = dao.check( id, passwd );
	if( result == 0 ) {
		// 비밀번호가 다르다
		%>
		<script type="text/javascript">
			<!--
			erroralert( passwderror );
			//-->
		</script>
		<%
	} else {
		// 비밀번호가 같다
		result = dao.deleteMember( id );
		if( result == 0 ) {
			// 탈퇴 실패
			%>
			<script type="text/javascript">
				<!--
				alert( deleteerror );
				//-->
			</script>
			<meta http-equiv="refresh" content="0; url=main.jsp">
			<%
		} else {
			// 탈퇴 성공
			session.removeAttribute( "memId" );
			response.sendRedirect( "main.jsp" );
		}
	}
%>