boolean 반환값으로 줘서 true / false 값 반환
String num,String pass
-> num(시퀀스)와 비밀번호를 비교해서 둘 다 일치하면 true 하나라도 안맞으면 false값 반환
값(rs.next())이 참이면 flag가 참이 된다
if(rs.next())
{
flag=true;
}
1개의 행만 배출할때 if, 복수의 행을 배출할때 while로 써서
rs.next()은 값이 있으면 true/없으면 false이기 때문에 그 안에 들어가면 true다 -> flag를 true로 바꿔주면 true값만 배출
이미지와 radio버튼의 연관성은 없지만 radio에 있는 value값을 브라우저 출력문인 guestForm에서 dto.getImage()와 dto.getStort()를 이어줘서 선택된 radio에 해당하는 image를 가져오게 만들어준다
<tr>
<td colspan="4">
<%
for(int i=1;i<=10;i++)
{%>
<input type="radio" value="<%=i%>" style="width: 40px;" name="image"
<%=i==3?"checked":"" %>>
<% }%>
<br>
<%
for(int i=1;i<=10;i++)
{%>
<img src="../image/f<%=i %>.png" style="width: 40px;">
<% }%>
</td>
</tr>
//비밀번호 비교...수정/삭제때 비밀번호가 맞는지 확인/ 비교는 시퀀스와 비밀번호를 비교해서 적용
//비밀번호가 맞으면 true,틀리면 false
public boolean isEqualPass(String num,String pass)
{
boolean flag=false;
Connection conn=db.getConnection();
PreparedStatement pstmt=null;
ResultSet rs=null;
String sql="select * from simpleGuest where num=? and pass=?";
try {
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, num);
pstmt.setString(2, pass);
rs=pstmt.executeQuery();
//값(rs.next())이 참이면 flag가 참이 된다
if(rs.next())
{
flag=true;
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
db.dbClose(pstmt, conn);
}
return flag;
}
함수에 num,pass를 인자값으로 받아서 클릭시 해당 num값과 pass값을 받아와 일치할 경우 삭제되는 로직
<%-- prompt 버전 --%>
<button type="button" class="btn btn-danger btn-sm"
onclick="prompass(<%=dto.getNum()%>,<%=dto.getPass()%>)">프롬프트 삭제</button>
<script> //prompt버전
function prompass(num,pass)
{
var question=prompt("비밀번호 입력해주세요");
//비밀번호가 문자열이면 인식이 안됨/취소버튼 아예 작동이 안됨
if(question==pass)
{
location.href='deleteAction.jsp?num='+num;
}
else
alert("비밀번호가 틀렸습니다");
}
</script>
useBean은 new로 객체를 생성하는것과 같다
<%-- id : 참조변수명 / class : 생성 --%>
<jsp:useBean id="dao" class="db.simpleguest.SimpleGuestDao"/>
<jsp:useBean id="dto" class="db.simpleguest.SimpleGuestDto"/>
setProperty의 name은 useBean의 id값을 불러옴
property="*"는 dto에 있는 모든 것을 form의 name으로 쓴다/자동 매칭해준다
조건문/multi 등이 들어갈 때는 사용 못한다
<jsp:setProperty property="*" name="dto"/>
updateAction에서 비밀번호 비교가 이루어진다
비밀번호가 맞으면 수정...수정 후 목록으로 이동
시퀀스(num)값과 pass값이 일치할 경우 update실행
아닐 경우 alert경고문 실행
if(dao.isEqualPass(num, pass))
{
SimpleGuestDto dto=new SimpleGuestDto();
dto.setNick(nick);
dto.setImage(image);
dto.setNum(num);
dto.setStory(story);
dao.updateSimpleGuest(dto);
response.sendRedirect("guestList.jsp");
}
else //틀리면 자바스크립트로 경고 후 이전 화면으로 이동
{%>
<script type="text/javascript">
alert("비밀번호가 맞지 않습니다");
history.back();
</script>
<%}
list의 삭제 버튼 클릭시 다른 폼으로 넘어가 비밀번호 비교 후 삭제
만든 input창에 name을 주어야 action에서 받아 올바르게 작동 가능
updateform과 똑같은 이유
if(dao.isEqualPass(num, pass))
{
SimpleGuestDto dto=new SimpleGuestDto();
dao.deleteSimpleGuest(num);
response.sendRedirect("guestList.jsp");
}
else
{%>
<script type="text/javascript">
alert("비밀번호가 맞지 않습니다");
history.back();
</script>
<%}
package db.simpleguest;
import java.sql.Timestamp;
public class SimpleGuestDto {
private String num;
private String nick;
private String pass;
private String image;
private String story;
private Timestamp writeday;
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getStory() {
return story;
}
public void setStory(String story) {
this.story = story;
}
public Timestamp getWriteday() {
return writeday;
}
public void setWriteday(Timestamp writeday) {
this.writeday = writeday;
}
}
package db.simpleguest;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import mysql.db.DBConnect;
public class SimpleGuestDao {
DBConnect db=new DBConnect();
public void insertSimpleGuest(SimpleGuestDto dto)
{
Connection conn=db.getConnection();
PreparedStatement pstmt=null;
String sql="insert into simpleGuest values(null,?,?,?,?,now())";
//String sql="insert into simpleGuest (image,nick,pass,story,writeday) values (?,?,?,?,now())";
try {
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, dto.getImage());
pstmt.setString(2, dto.getNick());
pstmt.setString(3, dto.getPass());
pstmt.setString(4, dto.getStory());
pstmt.execute();
} catch (SQLException e) {
} finally {
db.dbClose(pstmt, conn);
}
}
public Vector<SimpleGuestDto> getAllDates()
{
Vector<SimpleGuestDto> list=new Vector<SimpleGuestDto>();
Connection conn=db.getConnection();
PreparedStatement pstmt=null;
ResultSet rs=null;
String sql="select * from simpleGuest order by num";
try {
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
while(rs.next())
{
SimpleGuestDto dto=new SimpleGuestDto();
dto.setNum(rs.getString("num"));
dto.setImage(rs.getString("image"));
dto.setNick(rs.getString("nick"));
dto.setPass(rs.getString("pass"));
dto.setStory(rs.getString("story"));
dto.setWriteday(rs.getTimestamp("writeday"));
list.add(dto);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
db.dbClose(rs, pstmt, conn);
}
return list;
}
//비밀번호 비교...수정/삭제때 비밀번호가 맞는지 확인/ 비교는 시퀀스와 비밀번호를 비교해서 적용
//비밀번호가 맞으면 true,틀리면 false
public boolean isEqualPass(String num,String pass)
{
boolean flag=false;
Connection conn=db.getConnection();
PreparedStatement pstmt=null;
ResultSet rs=null;
String sql="select * from simpleGuest where num=? and pass=?";
try {
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, num);
pstmt.setString(2, pass);
rs=pstmt.executeQuery();
//값(rs.next())이 참이면 flag가 참이 된다
if(rs.next())
{
flag=true;
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
db.dbClose(pstmt, conn);
}
return flag;
}
//수정폼...하나의 dto값
public SimpleGuestDto getData(String num)
{
SimpleGuestDto dto=new SimpleGuestDto();
Connection conn=db.getConnection();
PreparedStatement pstmt=null;
ResultSet rs=null;
String sql="select * from simpleGuest where num=?";
try {
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, num);
rs=pstmt.executeQuery();
if(rs.next())
{
dto.setNum(rs.getString("num"));
dto.setNick(rs.getString("nick"));
dto.setPass(rs.getString("pass"));
dto.setStory(rs.getString("story"));
dto.setImage(rs.getString("image"));
dto.setWriteday(rs.getTimestamp("writeday"));
}
} catch (SQLException e) {
e.printStackTrace();
}finally {
db.dbClose(rs, pstmt, conn);
}
return dto;
}
//데이터수정...비번이 맞을 경우에만 호출할 것이므로
//비번은 조건에 안넣을 예정
//수정: 닉네임,이미지,스토리
public void updateSimpleGuest(SimpleGuestDto dto)
{
Connection conn=db.getConnection();
PreparedStatement pstmt=null;
String sql="update simpleGuest set nick=?,story=?,image=? where num=?";
try {
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, dto.getNick());
pstmt.setString(2, dto.getStory());
pstmt.setString(3, dto.getImage());
pstmt.setString(4, dto.getNum());
pstmt.execute();
} catch (SQLException e) {
e.printStackTrace();
} finally {
db.dbClose(pstmt, conn);
}
}
public void deleteSimpleGuest(String num)
{
Connection conn=db.getConnection();
PreparedStatement pstmt=null;
String sql="delete from simpleGuest where num=?";
try {
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, num);
pstmt.execute();
} catch (SQLException e) {
e.printStackTrace();
} finally {
db.dbClose(pstmt, conn);
}
}
}
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Cute+Font&family=Diphylleia&family=Dokdo&family=Nanum+Brush+Script&family=Nanum+Gothic+Coding&family=Noto+Sans+KR&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<title>Insert title here</title>
</head>
<body>
<div style="margin: 50px; 100px;">
<form action="insertAction.jsp" method="post">
<table class="table table-bordered" style="width: 500px;">
<caption align="top"><b>간단 방명록</b></caption>
<tr>
<th width="80" style="background-color: #48d1cc;">닉네임</th>
<td>
<input type="text" name="nick" required="required" style="width: 120px;">
</td>
<th width="100" style="background-color: #48d1cc;">비밀번호</th>
<td>
<input type="password" name="pass" required="required" style="width: 120px;">
</td>
</tr>
<tr>
<td colspan="4">
<%
for(int i=1;i<=10;i++)
{
%>
<input type="radio" value="<%=i%>" style="width: 40px;" name="image"
<%=i==3?"checked":"" %>>
<% }%>
<br>
<%
for(int i=1;i<=10;i++)
{
%>
<img src="../image/f<%=i %>.png" style="width: 40px;">
<% }%>
</td>
</tr>
<tr>
<td colspan="4">
<textarea style="width: 480px; height: 150px;" name="story"></textarea>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" value="저장" class="btn btn-outline-info">
<input type="submit" value="목록" class="btn btn-outline-success"
onclick="location.href='guestList.jsp'">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
<%@page import="java.util.List"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="db.simpleguest.SimpleGuestDto"%>
<%@page import="java.util.Vector"%>
<%@page import="db.simpleguest.SimpleGuestDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Cute+Font&family=Diphylleia&family=Dokdo&family=Nanum+Brush+Script&family=Nanum+Gothic+Coding&family=Noto+Sans+KR&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<title>Insert title here</title>
<style>
.writeday{
float: right;
color: gray;
}
.name{
margin-left: 40px;
text-align: center;
}
.story{
margin-left: 300px;
}
#table{
position: absolute;
left: 50px;
}
</style>
</head>
<%
SimpleGuestDao dao=new SimpleGuestDao();
Vector<SimpleGuestDto> list=dao.getAllDates();
%>
<body>
<div style="margin: 100px; 100px;">
<button type="button" class="btn btn-outline-info"
onclick="location.href='insertForm.jsp'">글쓰기</button>
</div>
<div id="table">
<table class="table table-bordered" style="width: 600px;">
<%
if(list.size()==0)
{%>
<div class=""><b>데이터가 없습니다</b></div>
<%}
else{
for(int i=list.size()-1;i>=0;i--)
{
//==for(int i=0;i<list.size();i++)
//{
// int no=list.size()-i;
//}
SimpleGuestDto dto=list.get(i);
%>
<tr>
<th>No.<%=i+1 %>
<span class="name"><%=dto.getNick() %></span>
<span class="writeday"><%=dto.getWriteday() %></span></th>
</tr>
<tr>
<td><img src="../image/f<%=dto.getImage() %>.png" align="right">
<pre><b><%=dto.getStory() %></b></pre></td>
</tr>
<tr>
<td align="right">
<button type="button" class="btn btn-warning btn-sm"
onclick="location.href='updateForm.jsp?num=<%=dto.getNum() %>'">수정</button>
<button type="button" class="btn btn-danger btn-sm"
onclick="location.href='deleteForm.jsp?num=<%=dto.getNum() %>'">삭제</button>
<%-- prompt 버전 --%>
<button type="button" class="btn btn-danger btn-sm"
onclick="prompass(<%=dto.getNum()%>,<%=dto.getPass()%>)">프롬프트 삭제</button>
</td>
</tr>
<%}
}
%>
</table>
</div>
<script> //prompt버전
function prompass(num,pass)
{
var question=prompt("비밀번호 입력해주세요");
//비밀번호가 문자열이면 인식이 안됨/취소버튼 아예 작동이 안됨
/* if(question==pass)
{ */
if (!isNaN(question) && question === pass)
{
location.href='deleteAction.jsp?num='+num;
}
else
alert("비밀번호가 틀렸습니다");
}
</script>
</body>
</html>
<%@page import="db.simpleguest.SimpleGuestDto"%>
<%@page import="db.simpleguest.SimpleGuestDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Cute+Font&family=Diphylleia&family=Dokdo&family=Nanum+Brush+Script&family=Nanum+Gothic+Coding&family=Noto+Sans+KR&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<title>Insert title here</title>
</head>
<body>
<%-- <% 기존 방법
request.setCharacterEncoding("utf-8");
String image=request.getParameter("image");
String nick=request.getParameter("nick");
String pass=request.getParameter("pass");
String story=request.getParameter("story");
SimpleGuestDao dao=new SimpleGuestDao();
SimpleGuestDto dto=new SimpleGuestDto();
dto.setImage(image);
dto.setNick(nick);
dto.setPass(pass);
dto.setStory(story);
dao.insertSimpleGuest(dto);
response.sendRedirect("guestList.jsp");
%> --%>
<%-- 자바빈즈로 변경하려면?
useBean은 new로 객체를 생성하는것과 같다 --%>
<%
request.setCharacterEncoding("utf-8");
%>
<%-- id : 참조변수명 / class : 생성 --%>
<jsp:useBean id="dao" class="db.simpleguest.SimpleGuestDao"/>
<jsp:useBean id="dto" class="db.simpleguest.SimpleGuestDto"/>
<%-- setProperty의 name은 useBean의 id값을 불러옴
property="*"는 dto에 있는 모든 것을 form의 name으로 쓴다/자동 매칭해준다
조건문/multi 등이 들어갈 때는 사용 못한다 --%>
<jsp:setProperty property="*" name="dto"/>
<%
//db에insert
dao.insertSimpleGuest(dto);
//목록으로이동
response.sendRedirect("guestList.jsp");
%>
</body>
</html>
<%@page import="db.simpleguest.SimpleGuestDto"%>
<%@page import="db.simpleguest.SimpleGuestDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Cute+Font&family=Diphylleia&family=Dokdo&family=Nanum+Brush+Script&family=Nanum+Gothic+Coding&family=Noto+Sans+KR&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<title>Insert title here</title>
</head>
<%
String num=request.getParameter("num");
SimpleGuestDao dao=new SimpleGuestDao();
SimpleGuestDto dto=dao.getData(num);
%>
<body>
<div style="margin: 50px; 100px;">
<form action="updateAction.jsp" method="post">
<input type="hidden" name="num" value="<%=num%>">
<table class="table table-bordered" style="width: 500px;">
<caption align="top"><b>간단 방명록</b></caption>
<tr>
<th width="80" style="background-color: #48d1cc;">닉네임</th>
<td>
<input type="text" name="nick" required="required" style="width: 120px;"
value="<%=dto.getNick()%>">
</td>
<th width="100" style="background-color: #48d1cc;">비밀번호</th>
<td>
<input type="password" name="pass" required="required" style="width: 120px;">
</td>
</tr>
<tr>
<td colspan="4">
<%
for(int i=1;i<=10;i++)
{
%>
<input type="radio" value="<%=i%>" style="width: 40px;" name="image"
<%=i==Integer.parseInt(dto.getImage())?"checked":"" %>>
<% }%>
<br>
<%
for(int i=1;i<=10;i++)
{
%>
<img src="../image/f<%=i %>.png" style="width: 40px;">
<% }%>
</td>
</tr>
<tr>
<td colspan="4">
<textarea style="width: 480px; height: 150px;" name="story">
<%=dto.getStory() %>
</textarea>
</td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" value="수정" class="btn btn-outline-warning">
<input type="submit" value="목록" class="btn btn-outline-success"
onclick="location.href='guestList.jsp'">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
<%@page import="db.simpleguest.SimpleGuestDto"%>
<%@page import="db.simpleguest.SimpleGuestDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Cute+Font&family=Diphylleia&family=Dokdo&family=Nanum+Brush+Script&family=Nanum+Gothic+Coding&family=Noto+Sans+KR&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String num=request.getParameter("num");
String nick=request.getParameter("nick");
String pass=request.getParameter("pass");
String image=request.getParameter("image");
String story=request.getParameter("story");
SimpleGuestDao dao=new SimpleGuestDao();
//비밀번호가 맞으면 수정...수정 후 목록으로 이동
if(dao.isEqualPass(num, pass))
{
SimpleGuestDto dto=new SimpleGuestDto();
dto.setNick(nick);
dto.setImage(image);
dto.setNum(num);
dto.setStory(story);
dao.updateSimpleGuest(dto);
response.sendRedirect("guestList.jsp");
}
else //틀리면 자바스크립트로 경고 후 이전 화면으로 이동
{%>
<script type="text/javascript">
alert("비밀번호가 맞지 않습니다");
history.back();
</script>
<%}
%>
</body>
</html>
<%@page import="db.simpleguest.SimpleGuestDto"%>
<%@page import="db.simpleguest.SimpleGuestDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Cute+Font&family=Diphylleia&family=Dokdo&family=Nanum+Brush+Script&family=Nanum+Gothic+Coding&family=Noto+Sans+KR&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<title>Insert title here</title>
</head>
<%
String num=request.getParameter("num");
SimpleGuestDao dao=new SimpleGuestDao();
SimpleGuestDto dto=dao.getData(num);
%>
<body>
<form action="deleteActionForm.jsp">
<input type="hidden" name="num" value="<%=num%>">
<table class="table table-bordered" style="width: 300px;">
<tr>
<th>비밀번호를 입력해주세요.</th>
<tr>
<tr>
<td>
<%-- name을 pass로 줘야 deleteActionForm에서 pass로 받아올 수 있고 비교할 수 있다 --%>
<input type="password" name="pass">
</td>
</tr>
<tr>
<td align="center">
<input type="submit" value="삭제" class="btn btn-outline-danger">
<input type="button" value="취소" class="btn btn-outline-info"
onclick="location.href='guestList.jsp'">
</td>
</tr>
</table>
</form>
</body>
</html>
<%@page import="db.simpleguest.SimpleGuestDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Cute+Font&family=Diphylleia&family=Dokdo&family=Nanum+Brush+Script&family=Nanum+Gothic+Coding&family=Noto+Sans+KR&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String num=request.getParameter("num");
SimpleGuestDao dao=new SimpleGuestDao();
dao.deleteSimpleGuest(num);
response.sendRedirect("guestList.jsp");
%>
</body>
</html>
<%@page import="db.simpleguest.SimpleGuestDto"%>
<%@page import="db.simpleguest.SimpleGuestDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Cute+Font&family=Diphylleia&family=Dokdo&family=Nanum+Brush+Script&family=Nanum+Gothic+Coding&family=Noto+Sans+KR&display=swap" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
SimpleGuestDao dao=new SimpleGuestDao();
String num=request.getParameter("num");
String pass=request.getParameter("pass");
if(dao.isEqualPass(num, pass))
{
SimpleGuestDto dto=new SimpleGuestDto();
dao.deleteSimpleGuest(num);
response.sendRedirect("guestList.jsp");
}
else
{%>
<script type="text/javascript">
alert("비밀번호가 맞지 않습니다");
history.back();
</script>
<%}
%>
</body>
</html>