Notice
Recent Posts
Recent Comments
Link
«   2025/03   »
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
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

update_page 본문

JSP/BBS

update_page

GAWON 2023. 6. 9. 17:56
<%@ 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>

'JSP > BBS' 카테고리의 다른 글

view  (0) 2023.06.09
update  (0) 2023.06.09
remove  (0) 2023.06.09
remove_page  (0) 2023.06.09
remove_Comment  (0) 2023.06.09