JSP/GuestBook
romove_page
GAWON
2023. 6. 2. 17:59
<%@page import="org.joonzis.ex.GuestbookDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
// 1. 비밀번호 확인 란이 비어있는가?
// 2. session에 저장된 비밀번호(DB에 저장된 pw)와 입력한 비밀번호가 같은가?
// 3. 일치 한다면 정말 삭제하겠는가? (confirm)
function remove(f){
if(f.pw.value == '' || f.pw.value != "${sessionScope.vo.pw}"){
alert("비밀번호를 확인해주세요");
return;
}
var a = confirm("삭제를 정말 하시겠습니까?");
if(a == true){
f.action = 'remove.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(3) {
text-align: center;
}
</style>
</head>
<body>
<div>
<h2>${vo.writer }의 방명록 삭제 확인</h2>
<form>
<table>
<tbody>
<tr>
<th>제목</th>
<td>${vo.title }</td>
</tr>
<tr>
<th>비밀번호 확인</th>
<td><input type="password" name="pw" size="80"></td>
</tr>
<tr>
<td colspan="2">
<input type="button" value="방명록 삭제" onclick="remove(this.form)">
<input type="button" value="목록으로 이동" onclick="location.href='index.jsp'">
</td>
</tr>
</tbody>
</table>
</form>
</div>
</body>
</html>