๋ฐ์ํ
01. ๐JSPFํ์ผ๋ก ๋ง๋ค์ด @inlclude ๋๋ ํฐ๋ธ๋ฅผ ์ด์ฉํ๋ฉด ์ข์ ์ฝ๋
- ๊ถํ๊ณผ ๊ด๋ จ๋ ๋ณด์์ฒ๋ฆฌ ์ค๋ณต์ฝ๋
- ๊ธฐ๋ก๊ด๋ จ ์ค๋ณต์ฝ๋
- ์์ธ์ฒ๋ฆฌ๊ด๋ จ ์ค๋ณต์ฝ๋
02. ๋ก๊ทธ์ธ ์ฌ์ฉ์์ธ์ง ํ์ธ (๐security > login_check.jspf)
<%@page import="xyz.itwill.dto.MemberDTO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
//<%-- ๋น๋ก๊ทธ์ธ ์ฌ์ฉ์์ธ ๊ฒฝ์ฐ ์๋ฌ๋ฉ์ธ์ง ์ถ๋ ฅํ์ด์ง(error_400.jsp)๋ก ์ด๋ํ๋ JSPF ํ์ผ --%>
<%
//์ธ์
์ ์ ์ฅ๋ ๊ถํ ๊ด๋ จ ์ ๋ณด๋ฅผ ๋ฐํ๋ฐ์ ์ ์ฅ
MemberDTO loginMember=(MemberDTO)session.getAttribute("loginMember");
//๋น๋ก๊ทธ์ธ ์ฌ์ฉ์๊ฐ JSP ๋ฌธ์๋ฅผ ์์ฒญํ ๊ฒฝ์ฐ - ๋น์ ์์ ์ธ ์์ฒญ์ ๋ํ ์๋ต ์ฒ๋ฆฌ
if(loginMember==null) {
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=error&work=error_400';");
out.println("</script>");
return;
}
%>
03. ๋ง์ดํ์ด์ง (member > member_mypage.jsp) - ์ ๋ ฅ
<%@page import="xyz.itwill.dto.MemberDTO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
//<%-- ๋ก๊ทธ์ธ ์ฌ์ฉ์์ ์ ๋ณด๋ฅผ ํด๋ผ์ด์ธํธ์๊ฒ ์ ๋ฌํ๋ JSP ๋ฌธ์ --%>
//<%-- => ๋ก๊ทธ์ธ ์ฌ์ฉ์๋ง ์์ฒญ ๊ฐ๋ฅํ JSP ๋ฌธ์ --%>
//<%-- => [ํ์์ ๋ณด๋ณ๊ฒฝ]์ ํด๋ฆญํ ๊ฒฝ์ฐ ๋น๋ฐ๋ฒํธ ์
๋ ฅํ์ด์ง(password_confirm.jsp)๋ก ์ด๋ - ํ์ด์ง ์ด๋ ๊ด๋ จ ์ ๋ณด ์ ๋ฌ --%>
//<%-- => [ํ์ํํด]๋ฅผ ํด๋ฆญํ ๊ฒฝ์ฐ ๋น๋ฐ๋ฒํธ ์
๋ ฅํ์ด์ง(password_confirm.jsp)๋ก ์ด๋ - ํ์ด์ง ์ด๋ ๊ด๋ จ ์ ๋ณด ์ ๋ฌ --%>
//<%-- ๐๋ฐฉ๋ฒ1.(๋น๊ถ์ฅ) --%>
/*
<%--
//์ธ์
์ ์ ์ฅ๋ ๊ถํ ๊ด๋ จ ์ ๋ณด๋ฅผ ๋ฐํ๋ฐ์ ์ ์ฅ
MemberDTO loginMember=(MemberDTO)session.getAttribute("loginMember");
//๋น๋ก๊ทธ์ธ ์ฌ์ฉ์๊ฐ JSP ๋ฌธ์๋ฅผ ์์ฒญํ ๊ฒฝ์ฐ - ๋น์ ์์ ์ธ ์์ฒญ์ ๋ํ ์๋ต ์ฒ๋ฆฌ
if(loginMember==null) {
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=error&work=error_400';");
out.println("</script>");
return;
}
--%>
*/
//<%-- ๐๋ฐฉ๋ฒ2.(๊ถ์ฅ) ์์ผ๋ก ๋ง์ด ์ธ ์ฝ๋๋ฅผ [jspfํ์ผ]๋ก ๋ง๋ค์ด include directive ์ด์ฉํ์ --%>
//<%-- => ๋์ ํฌํจ์ด ์๋๋ ํ์ฉํ๋ฉด ์ข์ ๊ฒ! --%>
//<%-- => ๊ถํ ๊ด๋ จ ์ค๋ณต์ฝ๋๋ฅผ JSPF ํ์ผ๋ก ์์ฑํ์ฌ include ๋๋ ํฐ๋ธ๋ฅผ ์ด์ฉํ์ฌ ํฌํจํ์ฌ ์ฌ์ฉ --%>
//<%-- => ์ฝ๋์ ์ค๋ณต์ ์ต์ํ ํ์ฌ ์์ฐ์ฑ์ ๋์ด๊ณ ์ ์ง๋ณด์์ ํจ์จ์ฑ ์ฆ๊ฐ --%>
<%@include file="/security/login_check.jspf" %>
<style type="text/css">
#datail {
width: 500px;
margin: 0 auto;
text-align: left;
}
#link{
font-size: 1.1em;
}
#link a:hover {
color: orange;
}
</style>
<h1>๋ด์ ๋ณด</h1>
<div id="datail">
<p>์์ด๋ = <%= loginMember.getId() %></p>
<p>์ด๋ฆ = <%= loginMember.getName() %></p>
<p>์ด๋ฉ์ผ = <%= loginMember.getEmail() %></p>
<p>์ ํ๋ฒํธ = <%= loginMember.getMobile() %></p>
<p>์ฃผ์ = [<%= loginMember.getZipcode()%>] <%=loginMember.getAddress1() %> <%=loginMember.getAddress2() %></p>
<p>ํ์๊ฐ์
๋ ์ง = <%= loginMember.getJoinDate() %></p>
<p>๋ง์ง๋ง ๋ก๊ทธ์ธ ๋ ์ง = <%= loginMember.getLastLogin() %></p>
</div>
<div id="link">
<a href="<%=request.getContextPath()%>/index.jsp?workgroup=member&work=password_confirm&action=modify">[ํ์์ ๋ณด ๋ณ๊ฒฝ]</a>
<a href="<%=request.getContextPath()%>/index.jsp?workgroup=member&work=password_confirm&action=remove">[ํ์ํํด]</a>
</div>
04. ๋น๋ฐ๋ฒํธ ํ์ธํ์ด์ง (member > password_confirm.jsp) - ์ ๋ ฅ
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
//<%-- ํ์์ ๋ณด๋ณ๊ฒฝ ๋๋ ํ์ํํด๋ฅผ ์ํ ๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅ๋ฐ๊ธฐ ์ํ JSP ๋ฌธ์ --%>
//<%-- => ๋ก๊ทธ์ธ ์ฌ์ฉ์๋ง ์์ฒญ ๊ฐ๋ฅํ JSP ๋ฌธ์ --%>
//<%-- => [์
๋ ฅ์๋ฃ]๋ฅผ ํด๋ฆญํ ๊ฒฝ์ฐ ์ ๋ฌ๊ฐ์ ์ํ ํ์ด์ง ์ด๋ - ์
๋ ฅ๊ฐ ์ ๋ฌ --%>
<%@include file="/security/login_check.jspf" %>
<%
//๋น์ ์์ ์ธ ์์ฒญ์ ๋ํ ์๋ต ์ฒ๋ฆฌ
if(request.getParameter("action")==null) { //action์ด๋ฆ์ผ๋ก ์ ๋ฌ๊ฐ์ด ์๋ ๊ฒฝ์ฐ
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=error&work=error_400';");
out.println("</script>");
return;
}
//์ ๋ฌ๊ฐ์ ๋ฐํ๋ฐ์ ์ ์ฅ
String action=request.getParameter("action");
//๋น์ ์์ ์ธ ์์ฒญ์ ๋ํ ์๋ต ์ฒ๋ฆฌ
if(!action.equals("modify") && !action.equals("remove")) {
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=error&work=error_400';");
out.println("</script>");
return;
}
String message=(String)session.getAttribute("message");
if(message==null) {
message="";
} else {
session.removeAttribute("message");
}
%>
//๋์์ธ์ด ๋๊ฐ์ JSP ๋ฌธ์๋ฅผ ์ ์ด๋ฌธ์ ํตํด ๋ด์ฉ๋ง ๋ค๋ฅด๋๋ก ๋ง๋ฆ!
//๋ด์ฉ ๋ค๋ฆ์ ๊ตฌ๋ถํ๊ธฐ ์ํด action ์ ๋ฌ๊ฐ์ ์ด์ฉํ์์
<% if(action.equals("modify")) { %>
<p>ํ์์ ๋ณด๋ณ๊ฒฝ์ ์ํด ๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.</p>
<% } else { %>
<p>ํ์ํํด๋ฅผ ์ํด ๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.</p>
<% } %>
<form method="post" name="passwordForm">
<input type="password" name="passwd">
<button type="button" onclick="submitCheck();">์
๋ ฅ์๋ฃ</button>
</form>
<p id="message" style="color:red"><%=message %></p>
<script type="text/javascript">
passwordForm.passwd.focus();
function submitCheck() {
if(passwordForm.passwd.value=="") {
document.getElementById("message").innerHTML="๋น๋ฐ๋ฒํธ๋ฅผ ๋ฐ๋์ ์
๋ ฅํด ์ฃผ์ธ์.";
passwordForm.passwd.focus();
return;
}
// <%-- ์ ๋ฌ๊ฐ์ ์ํด form ํ๊ทธ๋ก ์์ฒญํ๋ JSP ๋ฌธ์(action ์์ฑ๊ฐ)๋ฅผ ๋ค๋ฅด๊ฒ ์ค์ --%>
<% if(action.equals("modify")) { //[ํ์์ ๋ณด๋ณ๊ฒฝ]์ธ ๊ฒฝ์ฐ %>
passwordForm.action="<%=request.getContextPath()%>/index.jsp?workgroup=member&work=member_modify";
<% } else { //[ํ์ํํด]์ธ ๊ฒฝ์ฐ %>
passwordForm.action="<%=request.getContextPath()%>/index.jsp?workgroup=member&work=member_remove_action";
<% } %>
passwordForm.submit();
}
</script>
05. ํ์์ ๋ณด ๋ณ๊ฒฝํ์ด์ง (member > member_modify.jsp) - ์ ๋ ฅ
<%@page import="xyz.itwill.util.Utility"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
//<%-- ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ฌ๋ฐ์ ๋ก๊ทธ์ธ ์ฌ์ฉ์์ ๋น๋ฐ๋ฒํธ์ ๋น๊ตํ์ฌ ๊ฐ์ ๊ฒฝ์ฐ ๋ก๊ทธ์ธ ์ฌ์ฉ์์ ์ ๋ณด๋ฅผ ์
๋ ฅํ๊ทธ์ ์ด๊ธฐ๊ฐ์ผ๋ก ์ค์ ํ๊ณ ๋ณ๊ฒฝ๊ฐ์ ์
๋ ฅ๋ฐ๊ธฐ ์ํ JSP ๋ฌธ์ --%>
//<%-- => ๋ก๊ทธ์ธ ์ฌ์ฉ์๋ง ์์ฒญ ๊ฐ๋ฅํ JSP ๋ฌธ์ --%>
//<%-- => [ํ์๋ณ๊ฒฝ]์ ํด๋ฆญํ ๊ฒฝ์ฐ ํ์์ ๋ณด ๋ณ๊ฒฝํ์ด์ง(member_modify_action.jsp)๋ก ์ด๋ - ์
๋ ฅ๊ฐ ์ ๋ฌ --%>
<%@include file="/security/login_check.jspf" %>
<%
//๋น์ ์์ ์ธ ์์ฒญ์ ๋ํ ์๋ต ์ฒ๋ฆฌ
if(request.getMethod().equals("GET")) {
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=error&work=error_400';");
out.println("</script>");
return;
}
//์ ๋ฌ๊ฐ์ ๋ฐํ๋ฐ์ ์ ์ฅ
String passwd=Utility.encrypt(request.getParameter("passwd"));
//์ ๋ฌ๋ ๋น๋ฐ๋ฒํธ๊ฐ ๋ก๊ทธ์ธ ์ฌ์ฉ์์ ๋น๋ฐ๋ฒํธ์ ๊ฐ์ง ์์ ๊ฒฝ์ฐ ๋น๋ฐ๋ฒํธ ์
๋ ฅํ์ด์ง
//(password_confirm.jsp)๋ก ์ด๋
if(!passwd.equals(loginMember.getPasswd())) {
session.setAttribute("message", "๋น๋ฐ๋ฒํธ๊ฐ ๋ง์ง ์์ต๋๋ค.");
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=member&work=password_confirm&action=modify';");
out.println("</script>");
return;
}
%>
<style type="text/css">
fieldset { text-align: left; margin: 10px auto; width: 1100px; }
legend { font-size: 1.2em; }
#join label { width: 150px; text-align: right; float: left; margin-right: 10px; }
#join ul li { list-style-type: none; margin: 15px 0; }
#fs { text-align: center; }
.error { color: red; position: relative; left: 160px; display: none; }
#idCheck, #postSearch { font-size: 12px; font-weight: bold; cursor: pointer; margin-left: 10px; padding: 2px 10px; border: 1px solid black; }
#idCheck:hover, #postSearch:hover { background: aqua; }
</style>
<form id="join" action="index.jsp?workgroup=member&work=member_modify_action" method="post">
<fieldset>
<legend>ํ์์ ๋ณด๋ณ๊ฒฝ</legend>
<ul>
<li>
<label for="id">์์ด๋</label>
<input type="text" name="id" id="id" value="<%=loginMember.getId()%>" readonly="readonly">
</li>
<li>
<label for="passwd">๋น๋ฐ๋ฒํธ</label>
<input type="password" name="passwd" id="passwd">
<span style="color: red;">๋น๋ฐ๋ฒํธ๋ฅผ ๋ณ๊ฒฝํ์ง ์์ ๊ฒฝ์ฐ ์
๋ ฅํ์ง ๋ง์ธ์.</span>
<div id="passwdRegMsg" class="error">๋น๋ฐ๋ฒํธ๋ ์๋ฌธ์,์ซ์,ํน์๋ฌธ์๊ฐ ๋ฐ๋์ ํ๋์ด์ ํฌํจ๋ 6~20 ๋ฒ์์ ๋ฌธ์๋ก๋ง ์์ฑ ๊ฐ๋ฅํฉ๋๋ค.</div>
</li>
<li>
<label for="name">์ด๋ฆ</label>
<input type="text" name="name" id="name" value="<%=loginMember.getName()%>" >
<div id="nameMsg" class="error">์ด๋ฆ์ ์
๋ ฅํด ์ฃผ์ธ์.</div>
</li>
<li>
<label for="email">์ด๋ฉ์ผ</label>
<input type="text" name="email" id="email" value="<%=loginMember.getEmail()%>" >
<div id="emailMsg" class="error">์ด๋ฉ์ผ์ ์
๋ ฅํด ์ฃผ์ธ์.</div>
<div id="emailRegMsg" class="error">์
๋ ฅํ ์ด๋ฉ์ผ์ด ํ์์ ๋ง์ง ์์ต๋๋ค.</div>
</li>
<li>
<label for="mobile">์ ํ๋ฒํธ</label>
<% String[] mobile=loginMember.getMobile().split("-"); %>
<select name="mobile1">
<option value="010" <% if(mobile[0].equals("010")) { %> selected <% } %>> 010 </option>
<option value="011" <% if(mobile[0].equals("011")) { %> selected <% } %>> 011 </option>
<option value="016" <% if(mobile[0].equals("016")) { %> selected <% } %>> 016 </option>
<option value="017" <% if(mobile[0].equals("017")) { %> selected <% } %>> 017 </option>
<option value="018" <% if(mobile[0].equals("018")) { %> selected <% } %>> 018 </option>
<option value="019" <% if(mobile[0].equals("019")) { %> selected <% } %>> 019 </option>
</select>
- <input type="text" name="mobile2" id="mobile2" size="4" maxlength="4" value="<%=mobile[1]%>">
- <input type="text" name="mobile3" id="mobile3" size="4" maxlength="4" value="<%=mobile[2]%>">
<div id="mobileMsg" class="error">์ ํ๋ฒํธ๋ฅผ ์
๋ ฅํด ์
๋ ฅํด ์ฃผ์ธ์.</div>
<div id="mobileRegMsg" class="error">์ ํ๋ฒํธ๋ 3~4 ์๋ฆฌ์ ์ซ์๋ก๋ง ์
๋ ฅํด ์ฃผ์ธ์.</div>
</li>
<li>
<label>์ฐํธ๋ฒํธ</label>
<input type="text" name="zipcode" id="zipcode" size="7" value="<%=loginMember.getZipcode()%>" readonly="readonly">
<span id="postSearch">์ฐํธ๋ฒํธ ๊ฒ์</span>
<div id="zipcodeMsg" class="error">์ฐํธ๋ฒํธ๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.</div>
</li>
<li>
<label for="address1">๊ธฐ๋ณธ์ฃผ์</label>
<input type="text" name="address1" id="address1" size="50" value="<%=loginMember.getAddress1()%>" readonly="readonly">
<div id="address1Msg" class="error">๊ธฐ๋ณธ์ฃผ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.</div>
</li>
<li>
<label for="address2">์์ธ์ฃผ์</label>
<input type="text" name="address2" id="address2" size="50" value="<%=loginMember.getAddress2()%>" >
<div id="address2Msg" class="error">์์ธ์ฃผ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.</div>
</li>
</ul>
</fieldset>
<div id="fs">
<button type="submit">ํ์๋ณ๊ฒฝ</button>
<button type="reset">๋ค์์
๋ ฅ</button>
</div>
</form>
<script type="text/javascript">
$("#join").submit(function() {
var submitResult=true;
$(".error").css("display","none");
var passwdReg=/^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[~!@#$%^&*_-]).{6,20}$/g;
if($("#passwd").val()!="" && !passwdReg.test($("#passwd").val())) {
$("#passwdRegMsg").css("display","block");
submitResult=false;
}
if($("#name").val()=="") {
$("#nameMsg").css("display","block");
submitResult=false;
}
var emailReg=/^([a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+(\\.[-a-zA-Z0-9]+)+)*$/g;
if($("#email").val()=="") {
$("#emailMsg").css("display","block");
submitResult=false;
} else if(!emailReg.test($("#email").val())) {
$("#emailRegMsg").css("display","block");
submitResult=false;
}
var mobile2Reg=/\\d{3,4}/;
var mobile3Reg=/\\d{4}/;
if($("#mobile2").val()=="" || $("#mobile3").val()=="") {
$("#mobileMsg").css("display","block");
submitResult=false;
} else if(!mobile2Reg.test($("#mobile2").val()) || !mobile3Reg.test($("#mobile3").val())) {
$("#mobileRegMsg").css("display","block");
submitResult=false;
}
if($("#zipcode").val()=="") {
$("#zipcodeMsg").css("display","block");
submitResult=false;
}
if($("#address1").val()=="") {
$("#address1Msg").css("display","block");
submitResult=false;
}
if($("#address2").val()=="") {
$("#address2Msg").css("display","block");
submitResult=false;
}
return submitResult;
});
</script>
<script src="//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
<script>
$("#postSearch").click(function() {
new daum.Postcode({
oncomplete: function(data) {
$("#zipcode").val(data.zonecode);
$("#address1").val(data.address);
}
}).open();
});
</script>
05. ํ์์ ๋ณด ๋ณ๊ฒฝ ์ฒ๋ฆฌ (member > member_modify_action.jsp) - ์ฒ๋ฆฌ
<%@page import="xyz.itwill.dao.MemberDAO"%>
<%@page import="xyz.itwill.util.Utility"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
//<%-- ํ์์ ๋ณด๋ฅผ ์ ๋ฌ๋ฐ์ MEMBER ํ
์ด๋ธ์ ์ ์ฅ๋ ํ์์ ๋ณด๋ฅผ ๋ณ๊ฒฝํ๊ณ ๋ด์ ๋ณด ์ถ๋ ฅํ์ด์ง(member_mypage.jsp)๋ก ์ด๋ํ๊ธฐ ์ํ URL ์ฃผ์ ์ ๋ฌํ๋ JSP ๋ฌธ์ --%>
//<%-- => ๋ก๊ทธ์ธ ์ฌ์ฉ์๋ง ์์ฒญ ๊ฐ๋ฅํ JSP ๋ฌธ์ --%>
<%@include file="/security/login_check.jspf" %>
<%
//1.
//๋น์ ์์ ์ธ ์์ฒญ์ ๋ํ ์๋ต ์ฒ๋ฆฌ
if(request.getMethod().equals("GET")) {
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=error&work=error_400';");
out.println("</script>");
return;
}
//2.
//์ ๋ฌ๊ฐ์ ๋ฐํ๋ฐ์ ์ ์ฅ
String id=request.getParameter("id");
String passwd=request.getParameter("passwd");
if(passwd==null || passwd.equals("")) {//๋น๋ฐ๋ฒํธ ์ ๋ฌ๊ฐ์ด ์๋ ๊ฒฝ์ฐ
//๋ก๊ทธ์ธ ์ฌ์ฉ์์ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณ์์ ์ ์ฅ - ๊ธฐ์กด ๋น๋ฐ๋ฒํธ ์ ์ง
passwd=loginMember.getPasswd();
} else {//๋น๋ฐ๋ฒํธ ์ ๋ฌ๊ฐ์ด ์๋ ๊ฒฝ์ฐ
//์๋ก์ด ๋น๋ฐ๋ฒํธ๋ฅผ ์ํธํ ์ฒ๋ฆฌํ์ฌ ๋ณ์์ ์ ์ฅ - ๋น๋ฐ๋ฒํธ ๋ณ๊ฒฝ
passwd=Utility.encrypt(passwd);
}
String name=request.getParameter("name");
String email=request.getParameter("email");
String mobile=request.getParameter("mobile1")+"-"
+request.getParameter("mobile2")+"-"+request.getParameter("mobile3");
String zipcode=request.getParameter("zipcode");
String address1=request.getParameter("address1");
String address2=request.getParameter("address2");
//3.
//MemberDTO ๊ฐ์ฒด๋ฅผ ์์ฑํ์ฌ ์ ๋ฌ๊ฐ์ผ๋ก ํ๋๊ฐ ๋ณ๊ฒฝ
MemberDTO member=new MemberDTO();
member.setId(id);
member.setPasswd(passwd);
member.setName(name);
member.setEmail(email);
member.setMobile(mobile);
member.setZipcode(zipcode);
member.setAddress1(address1);
member.setAddress2(address2);
//4.
//ํ์์ ๋ณด๋ฅผ ์ ๋ฌ๋ฐ์ MEMBER ํ
์ด๋ธ์ ์ ์ฅ๋ ํ์์ ๋ณด๋ฅผ ๋ณ๊ฒฝํ๋ DAO ํด๋์ค์ ๋ฉ์๋ ํธ์ถ
MemberDAO.getDAO().updateMember(member);
//5.
//์ธ์
์ ์ ์ฅ๋ ๊ถํ ๊ด๋ จ ์ ๋ณด(ํ์์ ๋ณด) ๋ณ๊ฒฝ
session.setAttribute("loginMember", MemberDAO.getDAO().selectMember(id));
//6.
//ํด๋ผ์ด์ธํธ์๊ฒ URL ์ฃผ์ ์ ๋ฌ
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=member&work=member_mypage';");
out.println("</script>");
%>
06. ํ์์ ๋ณด ์ญ์ ์ฒ๋ฆฌ (member > member_remove_action.jsp) - ์ฒ๋ฆฌ
<%@page import="xyz.itwill.dao.MemberDAO"%>
<%@page import="xyz.itwill.util.Utility"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
//<%-- ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ฌ๋ฐ์ ๋ก๊ทธ์ธ ์ฌ์ฉ์์ ๋น๋ฐ๋ฒํธ์ ๋น๊ตํ์ฌ ๊ฐ์ ๊ฒฝ์ฐ MEMBER ํ
์ด๋ธ์ ์ ์ฅ๋ ํ์์ ๋ณด์ ํ์์ํ๋ฅผ ๋ณ๊ฒฝํ์ฌ ํํด ์ฒ๋ฆฌํ๊ณ ๋ก๊ทธ์์ ์ฒ๋ฆฌํ์ด์ง(member_logout_action.jsp)๋ก ์ด๋ํ๋ URL ์ฃผ์๋ฅผ ์ ๋ฌํ๋ JSP ๋ฌธ์ --%>
//<%-- => ๋ก๊ทธ์ธ ์ฌ์ฉ์๋ง ์์ฒญ ๊ฐ๋ฅํ JSP ๋ฌธ์ --%>
<%@include file="/security/login_check.jspf" %>
<%
//1.
//๋น์ ์์ ์ธ ์์ฒญ์ ๋ํ ์๋ต ์ฒ๋ฆฌ
if(request.getMethod().equals("GET")) {
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=error&work=error_400';");
out.println("</script>");
return;
}
//2.
//์ ๋ฌ๊ฐ์ ๋ฐํ๋ฐ์ ์ ์ฅ
String passwd=Utility.encrypt(request.getParameter("passwd"));
//3.
//์ ๋ฌ๋ ๋น๋ฐ๋ฒํธ๊ฐ ๋ก๊ทธ์ธ ์ฌ์ฉ์์ ๋น๋ฐ๋ฒํธ์ ๊ฐ์ง ์์ ๊ฒฝ์ฐ ๋น๋ฐ๋ฒํธ ์
๋ ฅํ์ด์ง
//(password_confirm.jsp)๋ก ์ด๋
if(!passwd.equals(loginMember.getPasswd())) {
session.setAttribute("message", "๋น๋ฐ๋ฒํธ๊ฐ ๋ง์ง ์์ต๋๋ค.");
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=member&work=password_confirm&action=remove';");
out.println("</script>");
return;
}
//4.
//์์ด๋์ ํ์์ํ๋ฅผ ์ ๋ฌ๋ฐ์ MEMBER ํ์ด๋ธ์ ์ ์ฅ๋ ํด๋น ์์ด๋์ ํ์์ ๋ณด์์ ํ์์ํ๋ฅผ
//๋ณ๊ฒฝํ๋ DAO ํด๋์ค์ ๋ฉ์๋ ํธ์ถ - ํํดํ์์ผ๋ก ๋ณ๊ฒฝ ์ฒ๋ฆฌ
MemberDAO.getDAO().updateStatus(loginMember.getId(), 0);
//5.
//ํด๋ผ์ด์ธํธ์๊ฒ URL ์ฃผ์ ์ ๋ฌ
out.println("<script type='text/javascript'>");
out.println("location.href='"+request.getContextPath()+"/index.jsp?workgroup=member&work=member_logout_action';");
out.println("</script>");
%>
๋ฐ์ํ