โโ๊ฒ์ํ ๋ต๊ธ ๋ฌ๊ธฐ- ๊ณ์ธต๊ตฌ์กฐ ์ง์(hierarchycal Query)โโ
์ค๋ผํด์์ ์ ๊ณตํด์ฃผ๋ ๊ณ์ธต๊ตฌ์กฐ ์ง์(hierarchycal Query)์ ํ์ฉํ์ฌ ๊ฒ์ํ์ ๋ต๊ธ ๋ฃ๊ธฐ
๊ธฐ์กด ๊ฒ์ํ [(22.12.02) ๊ฒ์ํ ๊ธ ์ฐธ๊ณ !!!] ์์ ๋ต๊ธ ๋ฌ๊ธฐ ๊ธฐ๋ฅ ๋ง๋ค๊ธฐ
M : BoardVO.java , BoardDAO.java
V : boardList.jsp , boardAdd.jsp , boardDetail.jsp , boardEdit.jsp , boardReple.jsp
C : ์๋ธ๋ฆฟ
MVC Service : BoardService.java
ํ์ฌ ๊ธ์ ์๋ java, jsp ํ์ผ์ (22.12.02)๊ธ ์ฐธ๊ณ
BoardService.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
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
|
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject;
public class BoardService
{
private HttpServletRequest request;
private HttpServletResponse response;
private String viewPath = "/WEB-INF/jsp/board";
public BoardService(HttpServletRequest request, HttpServletResponse response)
{
this.request = request;
this.response = response;
}
public String exec()
{
String cmd = request.getParameter("cmd");
if(cmd==null || cmd.equals("list"))
{
List<BoardVO> list = getList();
request.setAttribute("list", list);
return viewPath + "/boardList.jsp";
}
else if(cmd.equals("addBoard"))
{
return viewPath + "/boardAdd.jsp";
}
else if(cmd.equals("addResult"))
{
boolean added = addBoard();
JSONObject jsObj = new JSONObject();
Map<String, Object> map = new HashMap<>();
map.put("added", added);
sendJSONStr(map);
}
else if(cmd.equals("findById"))
{
int boardid = Integer.valueOf(request.getParameter("boardid"));
BoardVO board = findById(boardid);
request.setAttribute("board", board);
return viewPath + "/boardDetail.jsp";
}
else if(cmd.equals("editBoard"))
{
int boardid = Integer.valueOf(request.getParameter("boardid"));
BoardVO board = findById(boardid);
request.setAttribute("board", board);
return viewPath + "/boardEdit.jsp";
}
else if(cmd.equals("updateBoard"))
{
boolean updated = updateResult();
JSONObject jsObj = new JSONObject();
Map<String, Object> map = new HashMap<>();
map.put("updated", updated);
sendJSONStr(map);
}
else if(cmd.equals("deleteBoard"))
{
boolean deleted = deleteResult();
JSONObject jsObj = new JSONObject();
Map<String, Object> map = new HashMap<>();
map.put("deleted", deleted);
sendJSONStr(map);
}else if(cmd.equals("repleBoard"))
{
int boardid = Integer.valueOf(request.getParameter("boardid"));
BoardVO board = findById(boardid);
request.setAttribute("board", board);
return viewPath + "/boardReple.jsp";
}
else if(cmd.equals("repleAddBoard"))
{
boolean repleAdded = repleAddResult();
JSONObject jsObj = new JSONObject();
Map<String, Object> map = new HashMap<>();
map.put("repleAdded", repleAdded);
sendJSONStr(map);
}
return null;
}
public List<BoardVO> getList()
{
BoardDAO dao = new BoardDAO();
List<BoardVO> list = dao.getList();
return list;
}
public boolean addBoard() {
String title = request.getParameter("title");
String author = request.getParameter("author");
String contents = request.getParameter("contents");
BoardVO board = new BoardVO();
board.setTitle(title);
board.setAuthor(author);
board.setContents(contents);
BoardDAO dao = new BoardDAO();
return dao.addBoard(board);
}
public BoardVO findById(int boardid)
{
BoardDAO dao = new BoardDAO();
BoardVO board = dao.findById(boardid);
return board;
}
public boolean updateResult() {
int boardid = Integer.valueOf(request.getParameter("boardid"));
String title = request.getParameter("title");
String contents = request.getParameter("contents");
BoardVO board = new BoardVO();
board.setBoardid(boardid);
board.setTitle(title);
board.setContents(contents);
BoardDAO dao = new BoardDAO();
return dao.updateBoard(board);
}
public boolean repleAddResult()
{
int boardid = Integer.valueOf(request.getParameter("boardid"));
String title = request.getParameter("title");
String contents = request.getParameter("contents");
String author = request.getParameter("author");
BoardVO board = new BoardVO();
board.setParentid(boardid);
board.setTitle(title);
board.setAuthor(author);
board.setContents(contents);
BoardDAO dao = new BoardDAO();
return dao.reply(board);
}
public boolean deleteResult()
{
int boardid = Integer.valueOf(request.getParameter("boardid"));
BoardDAO dao = new BoardDAO();
return dao.deleteBoard(boardid);
}
public void sendJSONStr(Map<String, Object> map){
JSONObject jsobj = new JSONObject(map);
String jsStr = jsobj.toJSONString();
try {
PrintWriter out = response.getWriter();
out.print(jsStr);
out.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
cs |
72 ~ 78 ํ
else if(cmd.equals("repleBoard"))
{
int boardid = Integer.valueOf(request.getParameter("boardid"));
BoardVO board = findById(boardid);
request.setAttribute("board", board);
return viewPath + "/boardReple.jsp";
}
boardDetail.jsp ๋ทฐ์์ [๋ต๊ธ๋ฌ๊ธฐ] ๋งํฌ๋ฅผ ๋๋ฅด๋ฉด form์ ์ ์กํ๋ฉด์ cmd๋ repleBoard๋ก ์ ์กํ๋ค. ์๋น์ค์์ cmd๊ฐ repleBoard์ธ ๊ฒ์ ์ธ์งํ์ฌ ๊ฐ์ด hidden์ผ๋ก ๋์ด์จ boardid์ ๋ง๋ board ๊ฐ์ฒด๋ฅผ ์ฐพ์์ ๋ชจ๋ ๋ฐ์ดํฐ๋ฅผ boardReple.jsp์ ๋๊ธด๋ค. ๊ทธ๋ฆฌ๊ณ boardReple.jsp ๋ทฐ๋ก ๋์ด๊ฐ๊ฒ ๋๋ค.
79~86 ํ
else if(cmd.equals("repleAddBoard"))
{
boolean repleAdded = repleAddResult();
JSONObject jsObj = new JSONObject();
Map<String, Object> map = new HashMap<>();
map.put("repleAdded", repleAdded);
sendJSONStr(map);
}
boardReple.jsp ์์ ์ ๋ณด๋ฅผ ๊ธฐ์ ํ๊ณ '์ ์ฅ' ๋ฒํผ์ ๋๋ฅด๋ฉด cmd์ boardid๊ฐ ๋์ด์ค๊ฒ ๋๋ค. repleAddBoard ์ ๊ฐ๊ธฐ ๋๋ฌธ์ ๋ก์ง์ด ๋์๊ฐ๋ค. repleAddResult() ๋ฉ์๋์์ ๋ฆฌํด๋ ๊ฐ์ boolean ๋ณ์์ ์ ์ฅํ๊ณ map ์๋ฃ๊ตฌ์กฐ์ ๋ด์ json ๋ฌธ์์ด๋ก response์ ๋ณด๋ด์ฃผ๊ฒ ๋๋ค. ์ด response๋ boardReple.jsp success:function์ ํ๋ผ๋ฏธํฐ๋ก ๋ค์ด๊ฐ์ true๋ฉด ๋ต๊ธ๋ฌ๊ธฐ ์ฑ๊ณต์ false๋ฉด ๋ต๊ธ ๋ฌ๊ธฐ ์คํจ๋ฅผ alert์ฐฝ์ผ๋ก ๋ณด์ฌ์ฃผ๊ฒ๋๋ค.
127 ~ 143 ํ
public boolean repleAddResult()
{
int boardid = Integer.valueOf(request.getParameter("boardid"));
String title = request.getParameter("title");
String contents = request.getParameter("contents");
String author = request.getParameter("author");
BoardVO board = new BoardVO();
board.setParentid(boardid);
board.setTitle(title);
board.setAuthor(author);
board.setContents(contents);
BoardDAO dao = new BoardDAO();
return dao.reply(board);
}
์์ฒญ์์ ๋์ด์จ ํ๋ผ๋ฏธํฐ ๊ฐ๋ค์ ๊ฐ๊ฐ ๋ง๋ ๋ณ์์ ์ ์ฅํ๋ค. ๋ณด๋๊ฐ์ฒด๋ฅผ ์๋ก ๋ง๋ค์ด ๋ฐ์ดํฐ๋ค์ setํด์ฃผ๋๋ฐ ์ด๋ parentid๋ฅผ ๋์ด์จ boardid์ ๊ฐ๊ฒ ํด์ค๋ค. ๋์ค์ BoardDAO.java์์ sql ์ฟผ๋ฆฌ๋ก์ parentid=0๋ถํฐ ์ ๋ ฌํ์ฌ boardid์ parentid๊ฐ ๊ณ์ธต๊ตฌ์กฐ๋ฅผ ์ด๋ฃจ๊ฒ๋ ํ๊ธฐ ์ํจ์ด๋ค.
BoardDAO ๊ฐ์ฒด์ ๋ฐ์ดํฐ๋ฅผ setํ board๊ฐ์ฒด๋ฅผ ํ๋ผ๋ฏธํฐ๋ก ๋ณด๋ด์ฃผ์ด ๋์ด์จ ๊ฐ์ ๋ฆฌํดํ๋ค.
BoardDAO.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
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
204
205
206
207
208
209
210
211
212
213
214
|
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class BoardDAO {
private Connection conn;
private PreparedStatement pstmt;
private ResultSet rs;
private Connection getConn()
{
try {
Class.forName("oracle.jdbc.OracleDriver");
conn = DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe", "SCOTT", "TIGER");
this.conn = conn;
return conn;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public List<BoardVO> getList()
{
getConn();
try {
String sql = "SELECT boardid, LPAD('ใ', (LEVEL-1)*2,'ใ')||title AS title,"
+ " author, hitcnt, regdate, contents, parentid"
+ " FROM board START WITH parentid=0"
+ " CONNECT BY PRIOR boardid=parentid";
this.pstmt = conn.prepareStatement(sql);
this.rs = pstmt.executeQuery();
List<BoardVO> list = new ArrayList<>();
while(rs.next())
{
int boardid = rs.getInt("boardid");
String title = rs.getString("title");
String author = rs.getString("author");
java.sql.Date regdate = rs.getDate("regdate");
String contents = rs.getString("contents");
int hitcnt = rs.getInt("hitcnt");
int parentid = rs.getInt("parentid");
BoardVO board = new BoardVO();
board.setBoardid(boardid);
board.setTitle(title);
board.setAuthor(author);
board.setRegdate(regdate);
board.setContents(contents);
board.setHitcnt(hitcnt);
board.setParentid(parentid);
list.add(board);
}
return list;
}catch(Exception ex) {
ex.printStackTrace();
}finally {
closeAll();
}
return null;
}
public boolean addBoard(BoardVO board)
{
getConn();
try {
String sql = "INSERT INTO board "
+ "(boardid, title, contents, author) VALUES(DB_ID_SEQ.NEXTVAL,?,?,?)";
this.pstmt = conn.prepareStatement(sql);
pstmt.setString(1, board.getTitle());
pstmt.setString(2, board.getContents());
pstmt.setString(3, board.getAuthor());
int rows = pstmt.executeUpdate();
return rows>0 ? true : false;
}catch(Exception ex) {
ex.printStackTrace();
}finally {
closeAll();
}
return false;
}
public BoardVO findById(int boardid)
{
getConn();
try {
String sql = "UPDATE board SET hitcnt= hitcnt+1 WHERE boardid=?";
this.pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, boardid);
pstmt.executeUpdate();
String sql2 = "SELECT * FROM board WHERE boardid=?";
this.pstmt = conn.prepareStatement(sql2);
pstmt.setInt(1, boardid);
this.rs = pstmt.executeQuery();
if(rs.next())
{
int insertboardid = rs.getInt("BOARDID");
String title = rs.getString("TITLE");
String author = rs.getString("AUTHOR");
String contents = rs.getString("CONTENTS");
int hitcnt = rs.getInt("HITCNT");
java.sql.Date regdate = rs.getDate("REGDATE");
BoardVO board = new BoardVO();
board.setBoardid(insertboardid);
board.setTitle(title);
board.setAuthor(author);;
board.setContents(contents);
board.setHitcnt(hitcnt);
board.setRegdate(regdate);
return board;
}
}catch(Exception ex) {
ex.printStackTrace();
}finally {
closeAll();
}
return null;
}
public boolean updateBoard(BoardVO board)
{
getConn();
try {
String sql = "UPDATE board SET title=?, contents=? WHERE boardid=?";
this.pstmt = conn.prepareStatement(sql);
pstmt.setString(1, board.getTitle());
pstmt.setString(2, board.getContents());
pstmt.setInt(3, board.getBoardid());
int rows = pstmt.executeUpdate();
return rows>0 ? true : false;
}catch(Exception ex) {
ex.printStackTrace();
}finally {
closeAll();
}
return false;
}
public boolean deleteBoard(int boardid)
{
getConn();
try {
String sql = "DELETE FROM board WHERE boardid=?";
this.pstmt = conn.prepareStatement(sql);
pstmt.setInt(1,boardid);
int rows = pstmt.executeUpdate();
return rows>0 ? true : false;
}catch(Exception ex) {
ex.printStackTrace();
}finally {
closeAll();
}
return false;
}
public boolean reply(BoardVO board)
{
getConn();
try {
String sql = "INSERT INTO board "
+ "(boardid, title, contents, author, parentid)"
+ " VALUES(DB_ID_SEQ.NEXTVAL,?,?,?,?)";
this.pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "๐Re:"+board.getTitle());
pstmt.setString(2, board.getContents());
pstmt.setString(3, board.getAuthor());
pstmt.setInt(4, board.getParentid());
int rows = pstmt.executeUpdate();
return rows>0 ? true : false;
}catch(Exception ex) {
ex.printStackTrace();
}finally {
closeAll();
}
return false;
}
private void closeAll()
{
try {
if(rs!=null) rs.close();
if(pstmt!=null) pstmt.close();
if(conn!=null) conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
|
cs |
28 ~ 70 ํ
public List<BoardVO> getList()
{
getConn();
try {
String sql = "SELECT boardid, LPAD('ใ', (LEVEL-1)*2,'ใ')||title AS title,"
+ " author, hitcnt, regdate, contents, parentid"
+ " FROM board START WITH parentid=0"
+ " CONNECT BY PRIOR boardid=parentid";
this.pstmt = conn.prepareStatement(sql);
this.rs = pstmt.executeQuery();
List<BoardVO> list = new ArrayList<>();
while(rs.next())
{
int boardid = rs.getInt("boardid");
String title = rs.getString("title");
String author = rs.getString("author");
java.sql.Date regdate = rs.getDate("regdate");
String contents = rs.getString("contents");
int hitcnt = rs.getInt("hitcnt");
int parentid = rs.getInt("parentid");
BoardVO board = new BoardVO();
board.setBoardid(boardid);
board.setTitle(title);
board.setAuthor(author);
board.setRegdate(regdate);
board.setContents(contents);
board.setHitcnt(hitcnt);
board.setParentid(parentid);
list.add(board);
}
return list;
}catch(Exception ex) {
ex.printStackTrace();
}finally {
closeAll();
}
return null;
}
์ ๋ก์ง์ ๊ธฐ์กด์ ์๋ ๋ฆฌ์คํธ๋ฅผ ๋ณด์ฌ์ฃผ๋ ๋ก์ง์์ ์ด์ ๊ณ์ธต๊ตฌ์กฐ๋ฅผ ์จ์ ๋ต๊ธ์ด boardid๊ฐ ์ฆ ๊ธ๋ฒํธ๊ฐ ๋ฆ์ด๋ ์๊ธ์ ๋ฐ๋ก ์๋ ๊ฐ๊ฒ ๋ ํด์ฃผ๊ธฐ ์ํ์ฌ ๋ฐ๊ฟ์ฃผ์๋ค. ํต์ฌ์ ์ธ ๋ก์ง์ด ์๋ SQL ์ฟผ๋ฆฌ๋ฅผ ๋ฐ๋ SQL developer์์ ๋ํ๋ด๋ฉด ๋ค์๊ณผ ๊ฐ๋ค.
220ํ ~ 221ํ : parentid ๊ฐ 0์ธ ๊ธ๋ถํฐ ์์ํ๋ ๋์ ์ ๊ทธ ๋ค์๊ธ์ ์๊ธ์ boardid์ parentid๊ฐ ๊ฐ์๊ฑธ ์ค๊ฒ ๋ ํด์ค๋ค.
222 ํ : ๋ง์ฝ parentid๊ฐ ๊ฐ์ ํ์ ๊ธ์ด๋ผ๋ฉด boardid ์์๋๋ก ๋์ดํ๋ค.
218 ํ : ๊ณ์ธต๊ตฌ์กฐ๋ฅผ ๋ ์๋ณด์ด๊ฒ๋ ๋ค์ฌ์ฐ๊ธฐ๋ฅผ ํด์ฃผ๊ธฐ ์ํ ๋ก์ง์ด๋ค. ๋ ๋ฒจ์ -1์์ ๊ณฑํ๊ธฐ 2๋งํผ ๋น ๊ณต๋ฐฑ(ใฑ ํ์ํค 1๋ฒ)์ ๋์ฐ๊ฒ ์ค์ ํ๊ณ ๊ทธ๊ฑธ title์ด๋ผ๊ณ ๋ช ์ํ๋ค. ๋๋จธ์ง ์ปฌ๋ผ์ board ํ ์ด๋ธ์ ์ปฌ๋ผ๋ค์ด๋ค.
BoardDAO.java์ 177 ํ ~21 ํ
public boolean reply(BoardVO board)
{
getConn();
try {
String sql = "INSERT INTO board "
+ "(boardid, title, contents, author, parentid)"
+ " VALUES(DB_ID_SEQ.NEXTVAL,?,?,?,?)";
this.pstmt = conn.prepareStatement(sql);
pstmt.setString(1, "๐Re:"+board.getTitle());
pstmt.setString(2, board.getContents());
pstmt.setString(3, board.getAuthor());
pstmt.setInt(4, board.getParentid());
int rows = pstmt.executeUpdate();
return rows>0 ? true : false;
}catch(Exception ex) {
ex.printStackTrace();
}finally {
closeAll();
}
return false;
}
BoardService.java์ repleAddResult() ๋ฉ์๋์์ ๋์ด์จ board ๊ฐ์ฒด์์ ๋ฐ์ดํฐ๋ฅผ get ํด์์ preparestatment์ set ํด์ค๋ค. ๋ง์ฝ ์ฑ๊ณต์ ์ผ๋ก ์ ์ฅ์ด ๋๋ค๋ฉด ํ์ ๋ณํ๊ฐ ์๊ธฐ๊ฒ ๋๊ณ ํ์ ๋ณํ๋ฅผ 1์ ๋ฆฌํดํด์ฃผ๊ธฐ ๋๋ฌธ์ 0๋ณด๋ค ํฌ๋ฉด ์ ์ํ๋๋ค๋ true๋ฅผ ์คํจํ๋ค๋ฉด false๋ฅผ ๋ฆฌํดํ๊ฒ ๋๋ค.
boardReple.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
|
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>๊ฒ์๊ธ ๋ต๊ธ๋ฌ๊ธฐ</title>
<style type="text/css">
@import url(//fonts.googleapis.com/earlyaccess/jejumyeongjo.css);
.jm-font{
font-family: 'Jeju Myeongjo', serif;
color: orange;
font-size:1.5em;
}
.main-font{
font-family: 'Jeju Myeongjo', serif;/*์น ํฐํธ ์ง์ */
color: black;
font-size:1.5em;
}
.wrapper {
display: flex;
justify-content: center;
align-items: center;
}
main { width: fit-conent; margin:1em auto;}
main h1 { text-align: center; }
label { display:inline-block; margin-right:1em; width:fit-conent;
background-color:rgb(248,242,24); text-align:center; padding:0.5em;
}
div { margin-top:0.5em; width: fit-conent; }
</style>
<script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity=
"sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous">
</script>
<script type="text/javascript">
function updateBoard()
{
var obj = $('#updateForm').serialize();
$.ajax({
url : 'DBBoard',
method: 'post',
data: obj,
cache : false,
dataType:'json',
success:function(res){
alert(res.repleAdded ? '๋ต๊ธ๋ฌ๊ธฐ ์ฑ๊ณต' : '๋ต๊ธ๋ฌ๊ธฐ ์คํจ');
location.href="DBBoard?cmd=list";
},
error : function(xhr,status,err){
alert('์๋ฌ:' + err);
}
});
return false;
}
</script>
</head>
<body style="background-color: rgb(254,223,255);">
<span class="wrapper">
<main class="main-font">
<h1 class="jm-font">๊ฒ์๊ธ ๋ต๊ธ๋ฌ๊ธฐ</h1>
<form id="updateForm" onsubmit="return updateBoard();">
<input type="hidden" name="cmd" value="repleAddBoard">
<input type="hidden" name="boardid" value="${board.boardid}">
<div>
<label>1๏ธโฃ๊ธ์ ๋ชฉ</label>
<input id="title" type="text" name="title" value="${board.title}" style="height:40px">
</div>
<div>
<label>2๏ธโฃ์์ฑ์</label>
<input id="author" type="text" name="author" value="" style="height:40px">
</div>
<div>
<label>3๏ธโฃ๊ธ๋ด์ฉ</label>
<textarea id="contents" name="contents" rows="5" cols="50" style="height:150px"></textarea>
</div>
<div class="btn">
<a href="DBBoard?cmd=list">[๊ฒ์๊ธ ๋ชฉ๋ก๊ฐ๊ธฐ]</a>
<button type="reset">์ทจ์</button>
<button type="submit">์ ์ฅ</button>
</div>
</form>
</main>
</span>
</body>
</html>
|
cs |
BoardService.java ์์ ๋์ด์จ response์ repleAdded๊ฐ true๋ฉด ๋ต๊ธ๋ฌ๊ธฐ ์ฑ๊ณต์ false๋ฉด ๋ต๊ธ๋ฌ๊ธฐ ์คํจ๋ฅผ alert์ฐฝ์ ๋์ด๋ค.
์คํ๊ฒฐ๊ณผ :
๋๊ธ