JSP/GuestBook
update_page
GAWON
2023. 6. 2. 18:00
<%@page import="org.joonzis.ex.GuestbookDao"%>
<%@page import="org.joonzis.ex.GuestbookVO"%>
<%@ 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>
<script type="text/javascript">
function update(f){
if(
f.email.value == '' ||
f.title.value == ''||
f.content.value == ''){
alert("모든 내용을 입력하세요");
return;
}
f.action = 'update.jsp';
f.submit();
}
</script>
<style type="text/css">
div {
width: 800px;
margin: auto;
text-align: center;
}
table {
width: 100%;
border-collapse: collapse;
text-align: left;
}
td, th {
border: 1px solid black;
padding: 10px;
}
th {
width: 100px;
background-color: lime;
color: #fff;
text-align: center;
}
tr:nth-of-type(4) {
text-align: center;
}
</style>
<script type="text/javascript">
function update(f){
if(f.pw.value == '' || f.pw.value != "${vo.pw}"){
alert("비밀번호를 확인해주세요");
return;
}
f.action = "update.jsp";
f.submit();
}
</script>
</head>
<body>
<form action="post">
<div>
<h2>${vo.writer }의방명록</h2>
<table>
<tbody>
<tr>
<th>작성자</th>
<td>${vo.writer }</td>
</tr>
<tr>
<th>제목</th>
<td><input type="text" name="title" value="${vo.title }"></td>
</tr>
<tr>
<th>이메일</th>
<td><input type="text" name="email" value="${vo.email }"></td>
</tr>
<tr>
<th>첨부파일</th>
<td>${vo.filename }</td>
</tr>
<tr>
<th>내용</th>
<td><input type="text" name="content" value="${vo.content }"></td>
</tr>
<tr>
<th>작성일</th>
<td>${vo.reg_date }</td>
</tr>
<tr>
<th>비밀번호</th>
<td><input type="password" name="pw"></td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="방명록 수정"onclick="update(this.form)">
<input type="button" value="목록으로 이동"onclick="location.href='index.jsp'">
</td>
</tr>
</tbody>
</table>
</div>
<input type="hidden" name="idx" value="${vo.idx }">
</form>
</body>
</html>