boardDetailView
3rd times
3번째 반복 연습
머리에 박아두기!!
유레카
삭제 할려고 콘트롤러에 데이터 보낼 때, 삭제할 게시물 번호 외에도 해당 게시물에 파일이 있다면
파일명 데이터도 같이 보내야한다
즉 삭제할 게시물 번호와 해당 게시물 안에 있는 파일명을 컨트롤러로 보내줘야함
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>prac</title>
<style type="text/css">
#boardDetailTable{ width:800px; margin:auto; border-collapse:collapse; border-left:hidden; border-right:hidden;}
#boardDetailTable tr td{ padding: 5px;}
.replyTable{margin: auto; width:500px;}
</style>
</head>
<body>
<c:import url="../common/menubar.jsp"/>
<h1 align="center">${board.boradId }번 글의 상세보기</h1>
<form action="" method="post">
<table>
<tr>
<th>번호</th>
<td>
<input type="hidden" name="boardId" value="${ board.boardId }">
<input type="hidden" name="page" value="${ page }">
</td>
</tr>
<tr>
<th>제목</th>
<td>
${ board.boardTitle }
<input type="hidden" name="boardTitle" value="${ board.boardTitle }">
</td>
</tr>
<tr>
<th>작성자</th>
<td>
${ board.nickName }
<input type="hidden" name="nickName" value="${ board.nickName }">
</td>
</tr>
<tr>
<th>작성날짜</th>
<td>
${ board.board CreateDate }
</td>
</tr>
<tr>
<th>내용</th>
<% pageContext.setAttribute("newLineChar", "\r\n"); %>
<td>
${fn:replace(board.boardContent, newLineChar, "<br>" }
<input type="hidden" value="${ board.boardContent }" name="boardContent">
</td>
</tr>
<c:if test="${board.originalFileName != null }">
<tr>
<th>첨부파일</th>
<td>
<a href="${pageContext.servletContext.contextPath }/resources/buploadFiles/${board.renameFileName}" download="${board.originalFileName }"> ${board.originalFileName }</a>
<input type="hidden" name="renameFileName" value="${ board.renameFileName }">
<input type="hidden" name="originalFileName" vlaue="${ board.originalFileName }">
</td>
</tr>
</c:if>
<!-- url변수선언 -->
<c:url var="bdelete" value="bdelete.bo">
<c:param name="bId" value="${ board.boardId }"/>
<c:param name="renameFileName" value="${ board.renameFileName }"/>
</c:url>
<c:url var="blist" value="blist.bo">
<c:param name="page" value="${ page }"/>
</c:url>
<!-- 로그인한 유저가 작성자라면, 수정삭제버튼 보이기 -->
<c:if test="${ loginUser.id eq ${ board.boardWriter }">
<tr>
<td colspan="2" align="center">
<button type="button" onclick="locaiont.href='${ bupdate }'">수정하기</button>
<button type="button" onclick="location.href='${ bdelete }'">삭제하기</button>
</td>
</tr>
</c:if>
</table>
</form>
</body>
</html>
'small steps > 1일 1코딩 - 코딩을 내 몸처럼' 카테고리의 다른 글
[1일1코딩][Java] 객체배열 practice 2nd (0) | 2022.08.08 |
---|---|
[1일1코딩][Java] 객체배열 (0) | 2022.08.07 |
[1일1코딩][Web] boardDetailView.jsp 2nd (0) | 2022.08.05 |
[1일1코딩][Git] 브랜치 생성, 변경, 삭제, add, commit, merge (0) | 2022.08.04 |
[1일1코딩][JS] addEventListener & removeEventListener (0) | 2022.08.03 |