<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
div {
width: 800px;
margin: auto;
text-align: center;
}
table {
width: 800px;
border-collapse: collapse;
}
td, th {
border: 1px solid #1e90ff;
padding: 10px;
}
th {
background-color: #0078ff;
color: #fff;
text-align: center;
}
</style>
<script type="text/javascript">
function update(f){
var oriPw = '${bvo.pw}';
var chPw = f.pw.value;
if(oriPw != chPw){
alert("비밀번호가 일치하지 않습니다");
return;
}
if(
f.title.value == ''||
f.content.value == ''){
alert("수정할 내용을 입력하세요");
return;
}
f.action = 'update.jsp';
f.submit();
}
</script>
</head>
<body>
<div>
<h1>${bvo.b_idx } 번 게시글</h1>
<form method="post" enctype="multipart/form-data">
<table class="bbs">
<tbody>
<tr>
<th>작성자</th>
<td>${bvo.writer }</td>
</tr>
<tr>
<th>제목</th>
<td><input type="text" name="title" value="${bvo.title }"></td>
</tr>
<tr>
<th>비밀번호</th>
<td><input type="password" name="pw"></td>
</tr>
<tr>
<th>첨부파일</th>
<td>
<input type="file" name="filename">
<c:choose>
<c:when test="${bvo.filename eq null }">
[ 기존 첨부 파일 : 없음 ]
</c:when>
<c:otherwise>
[ 기존 첨부 파일 : ${bvo.filename } ]
<input type="hidden" name="oldfile" value="${bvo.filename }">
</c:otherwise>
</c:choose>
</td>
</tr>
<tr>
<th>내용</th>
<td>
<textarea rows="10" cols="80" name="content">${bvo.content }</textarea>
</td>
</tr>
<tr>
<td colspan="2" id="btn">
<input type="button" value="게시글 수정하기" onclick="update(this.form)">
<input type="reset" value="다시작성">
<input type="button" value="게시글로 이동" onclick="history.go(-1)">
</td>
</tr>
</tbody>
</table>
<input type="hidden" name="b_idx" value="${bvo.b_idx }">
</form>
</div>
</body>
</html>