fboardView.jsp
<div>
<a href="fboardList.do"><button type="button">목록</button></a>
<button type="button" onclick="updateBtn()">수정</button></a>
<button type="button" onclick="deleteBtn()">삭제</button>
</div>
<script>
function deleteBtn(){
if(confirm("게시글을 삭제하시겠습니까?"))location.href="doFboardDelete.do?bno="+${bBean.bno};}
/*confirm 확인 누르면, doFboardDelete.do로 bno 같이 보내줌*/
</script>
Bcontroller - doFboardDelete.do
case "doFboardDelete.do": //delete 페이지
bservice=new BServiceBoardDelete();
bservice.execute(request,response);
url="doFboard.jsp";
break;
✔BServiceBoardDelete
BoardDao bdao = new BoardDao();
int bno=Integer.parseInt(request.getParameter("bno"));
int result=bdao.boardDelete(bno);
if(result==1)request.setAttribute("result", "s-d");//성공
else request.setAttribute("result", "f-d"); //실패
✔ boardDelete-BoardDao
try {
conn=getConn();
query="delete freeboard where bno=?";
pstmt=conn.prepareStatement(query);
pstmt.setInt(1,bno2);
result=pstmt.executeUpdate();
return result;
doFboard.jsp - result값 체크 페이지
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:choose>
<c:when test="${result=='s-d'}">
<script>
alert("게시글이 삭제되었습니다.");
location.href="fboardList.do";
</script>
</c:when>
<c:when test="${result=='f-d'}">
<script>
alert("시스템 오류로 게시글 삭제 되지 않았습니다.");
location.href="fboardList.do";
</script>
</c:when>
</c:choose>
<!--두 경우 모두 fboardList.do로 보내줌 -->
<!-- fboardList.do에서 다시 삭제 된 후의 리스트를 가져옴 -->

