회원탈퇴
1.View
1) WebContent - deleteMember.jsp
2) WebContent - delete_result.jsp
2. Controller
1) src - controller.HandlerMapping.java에 delete 추가
2) src-controller.DeleteController.java
3.model
1)src - model.ClientDAO.java에 Delete 메소드 추가
1.View
1) WebContent - deleteMember.jsp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> < html > < head > < script type = "text/javascript" >if (!window.T) { window.T = {} } window.T.config = {"TOP_SSL_URL":"https://www.tistory.com","PREVIEW":false,"ROLE":"guest","PREV_PAGE":"","NEXT_PAGE":"","BLOG":{"id":3189920,"name":"dev-juniors","title":"개발자로가는길","isDormancy":true,"nickName":"서나브로","status":"open","profileStatus":"normal"},"NEED_COMMENT_LOGIN":false,"COMMENT_LOGIN_CONFIRM_MESSAGE":"","LOGIN_URL":"https://www.tistory.com/auth/login/?redirectUrl=https://dev-juniors.tistory.com/19","DEFAULT_URL":"https://dev-juniors.tistory.com","USER":{"name":null,"homepage":null,"id":0,"profileImage":null},"SUBSCRIPTION":{"status":"none","isConnected":false,"isPending":false,"isWait":false,"isProcessing":false,"isNone":true},"IS_LOGIN":false,"HAS_BLOG":false,"IS_SUPPORT":false,"IS_SCRAPABLE":false,"TOP_URL":"http://www.tistory.com","JOIN_URL":"https://www.tistory.com/member/join","PHASE":"prod","ROLE_GROUP":"visitor"}; window.T.entryInfo = {"entryId":19,"isAuthor":false,"categoryId":795522,"categoryLabel":"1.JAVA Web Programming/[3주차]JSP+model2"}; window.appInfo = {"domain":"tistory.com","topUrl":"https://www.tistory.com","loginUrl":"https://www.tistory.com/auth/login","logoutUrl":"https://www.tistory.com/auth/logout"}; window.initData = {}; window.TistoryBlog = { basePath: "", url: "https://dev-juniors.tistory.com", tistoryUrl: "https://dev-juniors.tistory.com", manageUrl: "https://dev-juniors.tistory.com/manage", token: "S3HrOmtyJ25xiJ27XHqnJCUZx5dtJHDE0IApVAdLP8DOi/K/VOCevjAEk3Sge6Vz" }; var servicePath = ""; var blogURL = "";</ script > < meta charset = "UTF-8" > < title >회원 탈퇴</ title > < style type = "text/css" >.another_category { border: 1px solid #E5E5E5; padding: 10px 10px 5px; margin: 10px 0; clear: both; } .another_category h4 { font-size: 12px !important; margin: 0 !important; border-bottom: 1px solid #E5E5E5 !important; padding: 2px 0 6px !important; } .another_category h4 a { font-weight: bold !important; } .another_category table { table-layout: fixed; border-collapse: collapse; width: 100% !important; margin-top: 10px !important; } * html .another_category table { width: auto !important; } *:first-child + html .another_category table { width: auto !important; } .another_category th, .another_category td { padding: 0 0 4px !important; } .another_category th { text-align: left; font-size: 12px !important; font-weight: normal; word-break: break-all; overflow: hidden; line-height: 1.5; } .another_category td { text-align: right; width: 80px; font-size: 11px; } .another_category th a { font-weight: normal; text-decoration: none; border: none !important; } .another_category th a.current { font-weight: bold; text-decoration: none !important; border-bottom: 1px solid !important; } .another_category th span { font-weight: normal; text-decoration: none; font: 10px Tahoma, Sans-serif; border: none !important; } .another_category_color_gray, .another_category_color_gray h4 { border-color: #E5E5E5 !important; } .another_category_color_gray * { color: #909090 !important; } .another_category_color_gray th a.current { border-color: #909090 !important; } .another_category_color_gray h4, .another_category_color_gray h4 a { color: #737373 !important; } .another_category_color_red, .another_category_color_red h4 { border-color: #F6D4D3 !important; } .another_category_color_red * { color: #E86869 !important; } .another_category_color_red th a.current { border-color: #E86869 !important; } .another_category_color_red h4, .another_category_color_red h4 a { color: #ED0908 !important; } .another_category_color_green, .another_category_color_green h4 { border-color: #CCE7C8 !important; } .another_category_color_green * { color: #64C05B !important; } .another_category_color_green th a.current { border-color: #64C05B !important; } .another_category_color_green h4, .another_category_color_green h4 a { color: #3EA731 !important; } .another_category_color_blue, .another_category_color_blue h4 { border-color: #C8DAF2 !important; } .another_category_color_blue * { color: #477FD6 !important; } .another_category_color_blue th a.current { border-color: #477FD6 !important; } .another_category_color_blue h4, .another_category_color_blue h4 a { color: #1960CA !important; } .another_category_color_violet, .another_category_color_violet h4 { border-color: #E1CEEC !important; } .another_category_color_violet * { color: #9D64C5 !important; } .another_category_color_violet th a.current { border-color: #9D64C5 !important; } .another_category_color_violet h4, .another_category_color_violet h4 a { color: #7E2CB5 !important; } </ style > < link rel = "stylesheet" type = "text/css" href = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/style/revenue.css" /> <!-- BEGIN STRUCTURED_DATA --> < script type = "application/ld+json" > {"@context":"http://schema.org","@type":"BlogPosting","mainEntityOfPage":{"@id":"https://dev-juniors.tistory.com/19","name":null},"url":"https://dev-juniors.tistory.com/19","headline":"Model2 Architecture - (6) 회원탈퇴","description":"회원탈퇴 1.View 1) WebContent - deleteMember.jsp 2) WebContent - delete_result.jsp HOME 2. Controller 1) src - controller.HandlerMapping.java에 delete 추가 if(command.equals("delete")) { c = new DeleteController(); } 2) src-controller.DeleteController.java package controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSessi..","author":{"@type":"Person","name":"서나브로","logo":null},"image":{"@type":"ImageObject","url":"https://img1.daumcdn.net/thumb/R800x0/?scode=mtistory2&fname=https%3A%2F%2Ft1.daumcdn.net%2Ftistory_admin%2Fstatic%2Fimages%2FopenGraph%2Fopengraph.png","width":"800px","height":"800px"},"datePublished":"2019-08-03T23:42:16+09:00","dateModified":"2019-08-03T23:43:10+09:00","publisher":{"@type":"Organization","name":"TISTORY","logo":{"@type":"ImageObject","url":"https://t1.daumcdn.net/tistory_admin/static/images/openGraph/opengraph.png","width":"800px","height":"800px"}}} </ script > <!-- END STRUCTURED_DATA --> < link rel = "stylesheet" type = "text/css" href = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/style/dialog.css" /> < link rel = "stylesheet" type = "text/css" href = "//t1.daumcdn.net/tistory_admin/www/style/top/font.css" /> < link rel = "stylesheet" type = "text/css" href = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/style/postBtn.css" /> < link rel = "stylesheet" type = "text/css" href = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/style/tistory.css" /> < script type = "text/javascript" src = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/script/common.js" ></ script > </ head > < body > < form action = "/DispatcherServlet" method = "post" > < input type = "hidden" name = "command" value = "delete" > </ form > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> < html > < head > < script type = "text/javascript" >if (!window.T) { window.T = {} } window.T.config = {"TOP_SSL_URL":"https://www.tistory.com","PREVIEW":false,"ROLE":"guest","PREV_PAGE":"","NEXT_PAGE":"","BLOG":{"id":3189920,"name":"dev-juniors","title":"개발자로가는길","isDormancy":true,"nickName":"서나브로","status":"open","profileStatus":"normal"},"NEED_COMMENT_LOGIN":false,"COMMENT_LOGIN_CONFIRM_MESSAGE":"","LOGIN_URL":"https://www.tistory.com/auth/login/?redirectUrl=https://dev-juniors.tistory.com/19","DEFAULT_URL":"https://dev-juniors.tistory.com","USER":{"name":null,"homepage":null,"id":0,"profileImage":null},"SUBSCRIPTION":{"status":"none","isConnected":false,"isPending":false,"isWait":false,"isProcessing":false,"isNone":true},"IS_LOGIN":false,"HAS_BLOG":false,"IS_SUPPORT":false,"IS_SCRAPABLE":false,"TOP_URL":"http://www.tistory.com","JOIN_URL":"https://www.tistory.com/member/join","PHASE":"prod","ROLE_GROUP":"visitor"}; window.T.entryInfo = {"entryId":19,"isAuthor":false,"categoryId":795522,"categoryLabel":"1.JAVA Web Programming/[3주차]JSP+model2"}; window.appInfo = {"domain":"tistory.com","topUrl":"https://www.tistory.com","loginUrl":"https://www.tistory.com/auth/login","logoutUrl":"https://www.tistory.com/auth/logout"}; window.initData = {}; window.TistoryBlog = { basePath: "", url: "https://dev-juniors.tistory.com", tistoryUrl: "https://dev-juniors.tistory.com", manageUrl: "https://dev-juniors.tistory.com/manage", token: "S3HrOmtyJ25xiJ27XHqnJCUZx5dtJHDE0IApVAdLP8DOi/K/VOCevjAEk3Sge6Vz" }; var servicePath = ""; var blogURL = "";</ script > < meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" > < title >회원 탈퇴</ title > < style type = "text/css" >.another_category { border: 1px solid #E5E5E5; padding: 10px 10px 5px; margin: 10px 0; clear: both; } .another_category h4 { font-size: 12px !important; margin: 0 !important; border-bottom: 1px solid #E5E5E5 !important; padding: 2px 0 6px !important; } .another_category h4 a { font-weight: bold !important; } .another_category table { table-layout: fixed; border-collapse: collapse; width: 100% !important; margin-top: 10px !important; } * html .another_category table { width: auto !important; } *:first-child + html .another_category table { width: auto !important; } .another_category th, .another_category td { padding: 0 0 4px !important; } .another_category th { text-align: left; font-size: 12px !important; font-weight: normal; word-break: break-all; overflow: hidden; line-height: 1.5; } .another_category td { text-align: right; width: 80px; font-size: 11px; } .another_category th a { font-weight: normal; text-decoration: none; border: none !important; } .another_category th a.current { font-weight: bold; text-decoration: none !important; border-bottom: 1px solid !important; } .another_category th span { font-weight: normal; text-decoration: none; font: 10px Tahoma, Sans-serif; border: none !important; } .another_category_color_gray, .another_category_color_gray h4 { border-color: #E5E5E5 !important; } .another_category_color_gray * { color: #909090 !important; } .another_category_color_gray th a.current { border-color: #909090 !important; } .another_category_color_gray h4, .another_category_color_gray h4 a { color: #737373 !important; } .another_category_color_red, .another_category_color_red h4 { border-color: #F6D4D3 !important; } .another_category_color_red * { color: #E86869 !important; } .another_category_color_red th a.current { border-color: #E86869 !important; } .another_category_color_red h4, .another_category_color_red h4 a { color: #ED0908 !important; } .another_category_color_green, .another_category_color_green h4 { border-color: #CCE7C8 !important; } .another_category_color_green * { color: #64C05B !important; } .another_category_color_green th a.current { border-color: #64C05B !important; } .another_category_color_green h4, .another_category_color_green h4 a { color: #3EA731 !important; } .another_category_color_blue, .another_category_color_blue h4 { border-color: #C8DAF2 !important; } .another_category_color_blue * { color: #477FD6 !important; } .another_category_color_blue th a.current { border-color: #477FD6 !important; } .another_category_color_blue h4, .another_category_color_blue h4 a { color: #1960CA !important; } .another_category_color_violet, .another_category_color_violet h4 { border-color: #E1CEEC !important; } .another_category_color_violet * { color: #9D64C5 !important; } .another_category_color_violet th a.current { border-color: #9D64C5 !important; } .another_category_color_violet h4, .another_category_color_violet h4 a { color: #7E2CB5 !important; } </ style > < link rel = "stylesheet" type = "text/css" href = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/style/revenue.css" /> <!-- BEGIN STRUCTURED_DATA --> < script type = "application/ld+json" > {"@context":"http://schema.org","@type":"BlogPosting","mainEntityOfPage":{"@id":"https://dev-juniors.tistory.com/19","name":null},"url":"https://dev-juniors.tistory.com/19","headline":"Model2 Architecture - (6) 회원탈퇴","description":"회원탈퇴 1.View 1) WebContent - deleteMember.jsp 2) WebContent - delete_result.jsp HOME 2. Controller 1) src - controller.HandlerMapping.java에 delete 추가 if(command.equals("delete")) { c = new DeleteController(); } 2) src-controller.DeleteController.java package controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSessi..","author":{"@type":"Person","name":"서나브로","logo":null},"image":{"@type":"ImageObject","url":"https://img1.daumcdn.net/thumb/R800x0/?scode=mtistory2&fname=https%3A%2F%2Ft1.daumcdn.net%2Ftistory_admin%2Fstatic%2Fimages%2FopenGraph%2Fopengraph.png","width":"800px","height":"800px"},"datePublished":"2019-08-03T23:42:16+09:00","dateModified":"2019-08-03T23:43:10+09:00","publisher":{"@type":"Organization","name":"TISTORY","logo":{"@type":"ImageObject","url":"https://t1.daumcdn.net/tistory_admin/static/images/openGraph/opengraph.png","width":"800px","height":"800px"}}} </ script > <!-- END STRUCTURED_DATA --> < link rel = "stylesheet" type = "text/css" href = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/style/dialog.css" /> < link rel = "stylesheet" type = "text/css" href = "//t1.daumcdn.net/tistory_admin/www/style/top/font.css" /> < link rel = "stylesheet" type = "text/css" href = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/style/postBtn.css" /> < link rel = "stylesheet" type = "text/css" href = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/style/tistory.css" /> < script type = "text/javascript" src = "https://tistory1.daumcdn.net/tistory_admin/userblog/userblog-39ee03342e373848ba7c0bb12e153b29db04aa6b/static/script/common.js" ></ script > </ head > < body > < a href = "index.jsp" >HOME</ a >< br >< br > <% String ret = (String)request.getAttribute("ret"); %> <%=ret %> |
1) src - controller.HandlerMapping.java에 delete 추가
1 2 3 | if (command.equals( "delete" )) { c = new DeleteController(); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | package controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import model.ClientDAO; public class DeleteController implements Controller { @Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println( "enter to DeleteController()..." ); String ret = ClientDAO.getInstance().deleteMember( "minnn" ); System.out.println(ret); HttpSession session = request.getSession(); session.invalidate(); request.setAttribute( "ret" , ret); return "delete_result.jsp" ; } } |
1)src - model.ClientDAO.java에 Delete 메소드 추가
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | // 회원 탈퇴 public String deleteMember(String id) throws SQLException { String ret = null ; Connection con = null ; PreparedStatement pstmt = null ; int result = 0 ; try { con = getConnection(); String sql = "delete from client where clientId = '" +id+ "'" ; System.out.println(sql); pstmt = con.prepareStatement(sql); result = pstmt.executeUpdate(); if (result> 0 ) ret = "delete your id. Thank you for using my site. See you and Good luck :)" ; else ret = "Not deleted." ; } catch (Exception e) { e.printStackTrace(); } finally { closeAll(pstmt, con); } System.out.println(ret); return ret; } |
'1.JAVA Web Programming > [3주차]JSP+model2' 카테고리의 다른 글
Model2 Architecture - (5) 회원수정 (0) | 2019.08.03 |
---|---|
Model2 Architecture - (4) 로그아웃 (0) | 2019.08.03 |
Model2 Architecture - (3) 로그인 (0) | 2019.08.02 |
Model2 Architecture - (2) 회원조회 (0) | 2019.08.01 |
Model2 Architecture - (1) 회원가입 (0) | 2019.08.01 |