jsp - mvc 패턴 적용 게시판 작성하기
앞에서 작성한
JSP - 작성자, 제목, 내용과 일치하는 항목 찾기 (1)
JSP - 작성자, 제목, 내용과 일치하는 항목 찾기 (2)
을 토대로 작성해보았다. 결과는 같지만 코드랑 작성방법은 다르다.
1) board_write.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
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link rel="stylesheet" href="css/layout.css">
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/join.js" defer></script>
</head>
<body>
<div class="formBox">
<h2>자유게시판</h2>
<form action="BoardWrite.do" id="joinForm" method="POST">
<table>
<colgroup>
<col style="width:150px">
<col style="width:850px">
</colgroup>
<tbody>
<tr>
<th>ID</th>
<td><input type="text" name="id" id="userID"></td>
</tr>
<tr>
<th>NAME</th>
<td><input type="text" name="name" id="userName" value=""></td>
</tr>
<tr>
<th>SUBJECT</th>
<td><input type="text" name="subject" id="subject" value=""></td>
</tr>
<tr>
<th>PASSWORD</th>
<td><input type="password" name="password" id="userPassword"></td>
</tr>
<tr>
<th>CONTENTS</th>
<td>
<textarea name="contents" id="contents"></textarea>
</td>
</tr>
</tbody>
</table>
<div class="btns">
<input type="submit" value="확인" id="join">
<input type="reset" value="취소" id="cancel">
</div>
</form>
</div>
</body>
</html>
|
cs |
와 함께 쓰이는
- BoardWriteFormController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package com.heeyeon.controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/BoardWriteForm.do")
public class BoardWriteFormController extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher dispatcher = request.getRequestDispatcher("board_write.jsp");
dispatcher.forward(request, response);
}
}
|
cs |
- BoardWriteController.java
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
|
package com.heeyeon.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.heeyeon.model.BoardBean;
import com.heeyeon.model.BoardDao;
@WebServlet("/BoardWrite.do")
public class BoardWriteController extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
BoardDao boardDao = new BoardDao();
String id = request.getParameter("id");
String name = request.getParameter("name");
String password = request.getParameter("password");
String subject = request.getParameter("subject");
String contents = request.getParameter("contents");
BoardBean boardBean = new BoardBean();
boardBean.setId(id);
boardBean.setName(name);
boardBean.setSubject(subject);
boardBean.setPassword(password);
boardBean.setContents(contents);
int result = boardDao.insertBoard(boardBean);
PrintWriter out = response.getWriter();
if(result>0) {
out.println("<script>");
out.println("alert('글이 등록되었습니다');");
out.println("location.href='BoardList.do';");
out.println("</script>");
} else {
out.println("<script>");
out.println("alert('등록 실패');");
out.println("history.back();");
out.println("</script>");
}
}
}
|
cs |
2) board_list.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
|
<%@page import="com.heeyeon.model.BoardBean"%>
<%@page import="com.heeyeon.model.BoardDao"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link
href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap"
rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<link rel="stylesheet" href="css/layout.css">
</head>
<body>
<div class="formBox" id="list">
<h2>자유게시판</h2>
<table>
<colgroup>
<col style="width: 50px">
<col style="width: 150px">
<col style="width: 150px">
<col style="width: 950px">
</colgroup>
<thead>
<tr>
<th>NO</th>
<th>ID</th>
<th>NAME</th>
<th>SUBJECT</th>
</tr>
</thead>
<tbody>
<c:forEach var="boardBean" items="${boardList }" begin="0" end="${boardList.size() }" step="1" varStatus="status">
<tr>
<td>${numbering - status.index}</td>
<td>${boardBean.id}</td>
<td>${boardBean.name}</td>
<td><a href="BoardView.do?no=${boardBean.no}">${boardBean.subject}</a></td>
</tr>
</c:forEach>
</tbody>
</table>
<div class="pagination">
<c:if test="${startPage > pageGroup }">
<a href="BoardList.do?clickedPage=${startPage - pageGroup}&searchSelect=${searchSelect}&searchWord=${searchWord}&isMode=${isMode}">
<span class="material-icons">chevron_left</span>
</a>
</c:if>
<c:forEach var="i" begin="${startPage }" end="${endPage }" step="1" varStatus="status">
<a href="BoardList.do?clickedPage=${i}&searchSelect=${searchSelect}&searchWord=${searchWord}&isMode=${isMode}">
${i}
</a>
</c:forEach>
<c:if test="${endPage < paginationTotal}">
<a href="BoardList.do?clickedPage=${startPage + pageGroup}&searchSelect=${searchSelect}&searchWord=${searchWord}&isMode=${isMode}">
<span class="material-icons">chevron_right</span>
</a>
</c:if>
</div>
<div class="searchBox">
<form action="BoardList.do">
<input type="hidden" name="isMode" value="search">
<select name="searchSelect" class="select">
<option value="name" ${param.searchSelect == "name"?"selected":""} >작성자</option>
<option value="subject" ${param.searchSelect == "subject"?"selected":""}>제목</option>
<option value="contents" ${param.searchSelect == "contents"?"selected":""}>내용</option>
</select> <input type="text" name="searchWord" value="${param.searchWord }" class="searchWord">
<input type="submit" value="검색">
</form>
</div>
<div class="btns">
<a href="BoardWriteForm.do" id="join">글쓰기</a>
</div>
</div>
</body>
</html>
|
cs |
- BoardListController
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
|
package com.heeyeon.controller;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.heeyeon.model.BoardBean;
import com.heeyeon.model.BoardDao;
@WebServlet("/BoardList.do")
public class BoardListController extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//데이터를 보낼때는
//request.setAttribute("msg","안녕하세요.");
String searchSelect = request.getParameter("searchSelect");
String searchWord = request.getParameter("searchWord");
String clickedPage = request.getParameter("clickedPage");
String isMode = request.getParameter("isMode");
if(searchSelect==null) searchSelect="";
if(searchWord==null) searchWord="";
if(isMode==null) isMode="";
//한 페이지에 보여질 게시글 수!
int pagePerCount = 10;
//request로 넘어오는 페이지 번호 즉 클릭한 페이지 번호
//값이 없을때 1로 세팅
if (clickedPage == null) {
clickedPage = "1";
}
//전체 게시글 수
int total = 0;
int numbering = 0;
int currentPage = Integer.parseInt(clickedPage);
int start = (currentPage - 1) * pagePerCount + 1;
int end = currentPage * pagePerCount;
ArrayList<BoardBean> boardList = null;
BoardDao boardDao = new BoardDao();
if(isMode.equals("search")){
boardList = boardDao.showAllSearchBoard(start, end, searchSelect, searchWord);
total = boardDao.getSearchTotal(searchSelect,searchWord);
} else {
boardList = boardDao.showAllBoard(start, end);
total = boardDao.getTotal();
}
numbering = total - (currentPage - 1) * pagePerCount;
/////////////////////////////boardList관련/////////////////////////////
int paginationTotal = (int) Math.floor(total / pagePerCount) + 1;
int pageGroup = 3;
int startPage = 1;
if (currentPage % pageGroup != 0) {
startPage = (int) (currentPage / pageGroup) * pageGroup + 1;
} else {
startPage = ((int) (currentPage / pageGroup) - 1) * pageGroup + 1;
}
int endPage = startPage + pageGroup - 1;
if (endPage > paginationTotal) {
endPage = paginationTotal;
}
request.setAttribute("boardList",boardList);
request.setAttribute("numbering",numbering);
request.setAttribute("paginationTotal", paginationTotal);
request.setAttribute("pageGroup", pageGroup);
request.setAttribute("startPage", startPage);
request.setAttribute("currentPage", currentPage);
request.setAttribute("endPage", endPage);
RequestDispatcher dispatcher = request.getRequestDispatcher("board_list.jsp");
dispatcher.forward(request, response);
}
}
|
cs |
3) board_view.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
|
<%@page import="com.heeyeon.model.BoardBean"%>
<%@page import="com.heeyeon.model.BoardDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="css/layout.css">
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/join.js" defer></script>
</head>
<body>
<%
int no = Integer.parseInt(request.getParameter("no"));
BoardDao boardDao = new BoardDao();
BoardBean boardBean = boardDao.getSelectOne(no);
//no를 통해 뽑혀진 하나의 row값을 boardBean의 속성으로 리턴 받았다.
%>
<div class="formBox">
<h2>자유게시판</h2>
<table>
<colgroup>
<col style="width:150px">
<col style="width:850px">
</colgroup>
<tbody>
<tr>
<th>NAME</th>
<td>${boardBean.name }</td>
</tr>
<tr>
<th>SUBJECT</th>
<td>${boardBean.subject }</td>
</tr>
<tr>
<th>CONTENTS</th>
<td>
<textarea name="contents" id="contents" readonly>${boardBean.contents}</textarea>
</td>
</tr>
</tbody>
</table>
<div class="btns">
<!-- <input type="button" value="확인" id="join"> -->
<!-- <input type="reset" value="취소" id="cancel"> -->
<a href = "BoardList.do">목록</a>
<a href = "BoardModifyForm.do?no=${boardBean.no }">수정</a>
<a href = "BoardDeleteForm.do?no=${boardBean.no }">삭제</a>
</div>
</form>
</div>
</body>
</html>
|
cs |
- BoardViewController.java
4) board_modify.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
|
<%@page import="com.heeyeon.model.BoardBean"%>
<%@page import="com.heeyeon.model.BoardDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="css/layout.css">
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/join.js" defer></script>
</head>
<body>
<%
// 없어도 됨.
int no = Integer.parseInt(request.getParameter("no"));
BoardDao boardDao = new BoardDao();
BoardBean boardBean = boardDao.getSelectOne(no);
//no를 통해 뽑혀진 하나의 row값을 boardBean의 속성으로 리턴 받았다.
%>
<div class="formBox">
<h2>자유게시판</h2>
<form action="BoardModify.do" id="joinForm" method="POST">
<table>
<colgroup>
<col style="width:150px">
<col style="width:850px">
</colgroup>
<tbody>
<!-- <tr> -->
<!-- <th>ID</th> -->
<%-- <td><%=boardBean.getId()%></td> --%>
<!-- </tr> -->
<tr>
<th>NAME</th>
<td><input type="text" name="name" value="${ boardBean.name}" readonly></td>
</tr>
<tr>
<th>SUBJECT</th>
<td><input type="text" name="subject" value="${boardBean.subject }"></td>
</tr>
<tr>
<th>PASSWORD</th>
<td><input type="password" name="password" id="userPassword"></td>
</tr>
<tr>
<th>CONTENTS</th>
<td>
<textarea name="contents" id="contents" value="">${boardBean.contents }</textarea>
</td>
</tr>
</tbody>
</table>
<div class="btns">
<input type="hidden" name="no" value="${boardBean.no }">
<input type="submit" value="확인">
<input type="reset" value="취소">
<a href = "BoardList.do">목록</a>
</div>
</form>
</div>
</body>
</html>
|
cs |
- BoardModifyFormController.java
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
|
package com.heeyeon.controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.heeyeon.model.BoardBean;
import com.heeyeon.model.BoardDao;
@WebServlet("/BoardModifyForm.do")
public class BoardModifyFormController extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int no = Integer.parseInt(request.getParameter("no"));
BoardDao boardDao = new BoardDao();
BoardBean boardBean = boardDao.getSelectOne(no);
request.setAttribute("boardBean", boardBean);
RequestDispatcher dispatcher = request.getRequestDispatcher("board_modify.jsp");
dispatcher.forward(request, response);
}
}
|
cs |
SUBJECT 에서 인사 -> 인사에서 수정했음요^.^ 로 수정
- BoardModifyController.java
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
|
package com.heeyeon.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.heeyeon.model.BoardBean;
import com.heeyeon.model.BoardDao;
@WebServlet("/BoardModify.do")
public class BoardModifyController extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
int no = Integer.parseInt(request.getParameter("no"));
String id = request.getParameter("id");
String name = request.getParameter("name");
String password = request.getParameter("password");
String subject = request.getParameter("subject");
String contents = request.getParameter("contents");
BoardBean boardBean = new BoardBean();
boardBean.setNo(no);
boardBean.setId(id);
boardBean.setName(name);
boardBean.setSubject(subject);
boardBean.setPassword(password);
boardBean.setContents(contents);
BoardDao boardDao = new BoardDao();
String dbPassword = boardDao.getPassword(no);// 넘겨받은 no를 통해 비밀번호 찾기....
PrintWriter out = response.getWriter();
if (dbPassword.equals(boardBean.getPassword())) {
int result = boardDao.updateBoard(boardBean);
if (result > 0) {
out.println("<script>");
out.println("alert('글이 수정되었습니다.');");
out.println("location.href='BoardList.do';");
out.println("</script>");
// 패스워드가 다르면 경고창
} else {
out.println("<script>");
out.println("alert('글 수정에 실패하였습니다.');");
out.println("history.back();");
out.println("</script>");
}
} else {
out.println("<script>");
out.println("alert('비밀번호를 확인해 주세요.');");
out.println("history.back();");
out.println("</script>");
}
}
}
|
cs |
5) board_delete.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
|
<%@page import="com.heeyeon.model.BoardBean"%>
<%@page import="com.heeyeon.model.BoardDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="css/layout.css">
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/join.js" defer></script>
</head>
<body>
<%
// controller안에 작성했으니 없어도 상관없음
int no = Integer.parseInt(request.getParameter("no"));
BoardDao boardDao = new BoardDao();
BoardBean boardBean = boardDao.getSelectOne(no);
//no를 통해 뽑혀진 하나의 row값을 boardBean의 속성으로 리턴 받았다.
%>
<div class="formBox">
<h2>자유게시판</h2>
<form action="BoardDelete.do" id="joinForm" method="POST">
<table>
<colgroup>
<col style="width:150px">
<col style="width:850px">
</colgroup>
<tbody>
<tr>
<th>NAME</th>
<td><input type="text" name="name" value="${boardBean.name}" readonly></td>
</tr>
<tr>
<th>SUBJECT</th>
<td><input type="text" name="subject" value="${boardBean.subject}"></td>
</tr>
<tr>
<th>PASSWORD</th>
<td><input type="password" name="password" id="userPassword"></td>
</tr>
<tr>
<th>CONTENTS</th>
<td>
<textarea name="contents" id="contents" value="">"${boardBean.contents}"</textarea>
</td>
</tr>
</tbody>
</table>
<div class="btns">
<input type="hidden" name="no" value="${boardBean.no}">
<input type="submit" value="확인">
<input type="reset" value="취소">
<a href = "BoardList.do">목록</a>
</div>
</form>
</div>
</body>
</html>
|
cs |
- BoardDeleteFormController.java
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
|
package com.heeyeon.controller;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.heeyeon.model.BoardBean;
import com.heeyeon.model.BoardDao;
@WebServlet("/BoardDeleteForm.do")
public class BoardDeleteFormController extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int no = Integer.parseInt(request.getParameter("no"));
BoardDao boardDao = new BoardDao();
BoardBean boardBean = boardDao.getSelectOne(no);
request.setAttribute("boardBean", boardBean);
RequestDispatcher dispatcher = request.getRequestDispatcher("board_delete.jsp");
dispatcher.forward(request, response);
}
}
|
cs |
- BoardDeleteController.java
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
|
package com.heeyeon.controller;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.heeyeon.model.BoardBean;
import com.heeyeon.model.BoardDao;
@WebServlet("/BoardDelete.do")
public class BoardDeleteController extends HttpServlet {
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
int no = Integer.parseInt(request.getParameter("no"));
String name = request.getParameter("name");
String password = request.getParameter("password");
String subject = request.getParameter("subject");
String contents = request.getParameter("contents");
BoardBean boardBean = new BoardBean();
boardBean.setNo(no);
boardBean.setName(name);
boardBean.setSubject(subject);
boardBean.setPassword(password);
boardBean.setContents(contents);
BoardDao boardDao = new BoardDao();
String dbPassword = boardDao.getPassword(no);// 넘겨받은 no를 통해 비밀번호 찾기....
PrintWriter out = response.getWriter();
if (dbPassword.equals(boardBean.getPassword())) {
int result = boardDao.deleteBoard(no);
if (result > 0) {
out.println("<script>");
out.println("alert('글이 삭제되었습니다.');");
out.println("location.href='BoardList.do';");
out.println("</script>");
// 패스워드가 다르면 경고창
} else {
out.println("<script>");
out.println("alert('글 삭제에 실패하였습니다.');");
out.println("history.back();");
out.println("</script>");
}
} else {
out.println("<script>");
out.println("alert('비밀번호를 확인해 주세요.');");
out.println("history.back();");
out.println("</script>");
}
}
}
|
cs |
비밀번호 일치시 삭제된다.
오라클 DB랑 시퀀스 DB도 필요하다.
com.heeyeon.model안에 있는 파일은
JSP - 작성자, 제목, 내용과 일치하는 항목 찾기 (1)
JSP - 작성자, 제목, 내용과 일치하는 항목 찾기 (2)
여기를 참고하여 작성. 똑같다.