a6468920
sangkiham
Spring Boot Board...
|
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
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/default_layout}">
<!-- index.html 고유 CSS 추가 -->
<th:block layout:fragment="css">
</th:block>
<!-- index.html 고유 스크립트 추가 -->
<th:block layout:fragment="script">
<script type="text/javascript">
$(document).ready(function(){
});
/** 게시판 - 목록 페이지 이동 */
function goBoardList(){
location.href = "[[@{/}]]board/boardList";
}
/** 게시판 - 작성 */
function insertBoard(){
var boardSubject = $("#board_subject").val();
var boardContent = $("#board_content").val();
if (boardSubject == ""){
alert("제목을 입력해주세요.");
$("#board_subject").focus();
return;
}
if (boardContent == ""){
alert("내용을 입력해주세요.");
$("#board_content").focus();
return;
}
var yn = confirm("게시글을 등록하시겠습니까?");
if(yn){
var filesChk = $("input[name='files[0]']").val();
if(filesChk == ""){
$("input[name='files[0]']").remove();
}
$("#boardForm").ajaxForm({
url : "[[@{/}]]board/insertBoard",
enctype : "multipart/form-data",
cache : false,
async : true,
type : "POST",
success : function(obj) {
insertBoardCallback(obj);
},
error : function(xhr, status, error) {}
}).submit();
}
}
/** 게시판 - 작성 콜백 함수 */
function insertBoardCallback(pobj){
var obj = pobj.BoardDto;
if(obj != null){
var result = obj.result;
if(result == "SUCCESS"){
alert("게시글 등록을 성공하였습니다.");
goBoardList();
} else {
alert("게시글 등록을 실패하였습니다.");
return;
}
}
}
</script>
</th:block>
<th:block layout:fragment="content">
<div id="wrap">
<div id="container">
<div class="inner">
<h2>신규작성</h2>
<form id="boardForm" name="boardForm" action="[[@{/}]]board/insertBoard" enctype="multipart/form-data" method="post" onsubmit="return false;">
|
a6468920
sangkiham
Spring Boot Board...
|
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
|
<caption><strong><span class="t_red">*</span> 표시는 필수입력 항목입니다.</strong></caption>
<colgroup>
<col width="20%">
<col width="*">
</colgroup>
<tbody id="tbody">
<tr>
<th>제목<span class="t_red">*</span></th>
<td><input id="board_subject" name="board_subject" value="" class="tbox01"/></td>
</tr>
<tr>
<th>작성자<span class="t_red">*</span></th>
<td><input id="board_writer" name="board_writer" th:value="${user_id}" class="tbox01" readonly="readonly"/></td>
</tr>
<tr>
<th>내용<span class="t_red">*</span></th>
<td><textarea id="board_content" name="board_content" cols="10" rows="5" class="textarea01"></textarea></td>
</tr>
<tr>
<th scope="row">첨부파일</th>
<td><input type="file" id="files[0]" name="files[0]" value=""></td>
</tr>
</tbody>
</table>
</form>
<div class="btn_right mt15">
<button type="button" class="btn black mr5" onclick="javascript:goBoardList();">목록으로</button>
<button type="button" class="btn black" onclick="javascript:insertBoard();">등록하기</button>
</div>
</div>
</div>
</div>
</th:block>
</html>
|