Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
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 본문

JSP/JSP.sideproject

update_page.jsp

GAWON 2023. 6. 23. 12:48
<%@ 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;
	}
	table{
		width: 100%;
		text-align: left;
		border-collapse: collapse;
	} 
	td,th{
		border: 1px solid green;
		padding: 10px;
	}
	th{
		background-color: green;
		color: #fff;
		text-align: center;
	}
	#btn, h1{
		text-align: center;
	}
</style>
<script type="text/javascript">
	function update(f){
		var pw = '${bvo.pw}';	
		if(pw != f.pw.value){
			alert("비밀번호가 일치하지 않습니다.")
			return;
		}
		if(f.title.value == ''){
			alert("제목을 입력하세요");
			return;
		}
		if(f.content.value == ''){
			alert("내용을 입력하세요");
			return;
		}
		f.action = '/chapter99/BBSController';
		f.submit();
	}
	function view_all(){
		var cp = '${currentPage}';
		location.href='BBSController?cmd=allList&currentPage=' + cp;
	}
</script>
</head>
<body>
	<div>
		<h1>${bvo.b_idx }번 게시글 수정</h1>
		<form method="post" enctype="multipart/form-data">
			<table>
				<tbody>
					<tr>
						<th>작성자</th>
						<td>${bvo.writer }<input type="hidden" name="writer" value="${bvo.writer }"></td>
					</tr>
					<tr>
						<th>제목</th>
						<td><input type="text" name="title" value="${bvo.title}" size="80"></td>
					</tr>
					<tr>
						<th>비밀번호</th>
						<td><input type="password" name="pw" size="80"></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)">&nbsp;&nbsp;
							<input type="reset" value="다시 작성">&nbsp;&nbsp;
							<input type="button" value="목록으로 이동" onclick="view_all()">
							<input type="hidden" name="b_idx" value="${bvo.b_idx }">
							<input type="hidden" name="currentPage" value="${currentPage }">
							<input type="hidden" name="cmd" value="update">
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
</body>
</html>

'JSP > JSP.sideproject' 카테고리의 다른 글

view.jsp  (0) 2023.06.23
update.jsp  (0) 2023.06.23
remove_page.jsp  (0) 2023.06.23
remove_comment.jsp  (0) 2023.06.23
insert.jsp  (0) 2023.06.23