boardContent.jsp
<c:if test="${ not empty memberVO }">
<div class="col s6 m3">
<a href="/board/modify?num=${boardVO.num}&pageNum=${pageNum}" class="btn-large waves-effect waves-light"> <i class="material-icons left">edit</i> 글수정
</a>
</div>
<div class="col s6 m3">
<form action="**/board/delete?num=${boardVO.num}**" method="get">
<a class="btn-large waves-effect waves-light" id="del" onclick="confirmDel();"> <i class="material-icons left">delete</i> 글삭제
</a>
</form>
</div>
</c:if>
// 안됐음 ^^ 삭제만 되고 넘어가지질 않아ㅜ
<script>
function confirmDel() {
var confirm = window.confirm("정말 삭제하시겠습니까?");
if (confirm == true) {
fetch(`http://localhost:8000/board/delete?num=${boardVO.num}`);
};
};
</script>
BoardController
@GetMapping("/delete")
public String delete(int num) {
System.out.println("요청왔다" + num);
int result = boardService.removeBoard(num);
if (result == 1) {
System.out.println("삭제완료");
return "/board/list"; // 왜 안되지???????
}
return "/";
}