νλ‘μ νΈ κΈ°λ‘
μμ½ μ ν μ·¨μ κΈ°λ₯ μΆκ°
μ½λ©νλ λΆμ΄
2021. 2. 15. 02:46
λ°μν
ν λͺ μ νμμ΄ μ¬λ¬λ² μμ½μ νμ λ
μμ½μ μ νν΄μ μ·¨μν μ μκ² κ΅¬ννμλ€
β
β
ββ
ReservationRemoveAction.java
package reservation.action;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import action.Action;
import reservation.svc.ReservationRemoveService;
import subject.svc.SubjectCartRemoveService;
import vo.ActionForward;
public class ReservationRemoveAction implements Action {
@Override
public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String[] res_num = request.getParameterValues("res_num");
ReservationRemoveService reservationRemoveService = new ReservationRemoveService();
boolean result = reservationRemoveService.removeResService(res_num);
ActionForward forward = null;
if (result == true) {
forward = new ActionForward("ReservationViewAction.res", false);
} else {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<script>");
out.println("alert('μμ½ μ·¨μ μ€ν¨')");
out.println("history.back()");
out.println("</script>");
}
return forward;
}
}
ReservationRemoveService.java
package reservation.svc;
import static db.JdbcUtil.close;
import static db.JdbcUtil.commit;
import static db.JdbcUtil.getConnection;
import static db.JdbcUtil.rollback;
import java.sql.Connection;
import dao.ReservationDAO;
public class ReservationRemoveService {
public boolean removeResService(String res_num[]) {
boolean deleteResult = false;
Connection con = getConnection();
ReservationDAO reservationDAO = ReservationDAO.getInstance();
reservationDAO.setConnection(con);
int deleteCount = reservationDAO.deleteReservation(res_num);
if (deleteCount > 0) {
commit(con);
deleteResult = true;
} else {
rollback(con);
}
close(con);
return deleteResult;
}
}
appointment_cos.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="vo.Reservation"%>
<%@ page import="dao.ReservationDAO"%>
<%@ page import="vo.MemberBean"%>
<%@ page import="dao.MemberDAO"%>
<%@ page import="java.util.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<fmt:requestEncoding value="UTF-8" />
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>μμ½νμΈνμ΄μ§(νμ)</title>
</head>
<body>
<div class="card shadow mb-4">
<div class="mem_list">
<br>
<h2 class="h3 mb-2 text-gray-800">${memberLog.member_name}λμ μμ½μ 보</h2>
<br>
</div>
<form action="ReservationRemove.res" name="remove" method="post">
<table class="table3 table-bordered" id="dataTable" cellspacing="0" align="center">
<tr align="center">
<td width=200px; height=50px;><b>μ ν</b></td>
<td width=200px; height=50px;><b>λ°λ €λλ¬Ό μ΄λ¦</b></td>
<td width=200px;><b>μ’
λ₯</b></td>
<td width=200px;><b>μ§λ£λͺ
</b></td>
<td width=200px;><b>μμ½λ μ§</b></td>
<td width=200px;><b>νΉμ΄μ¬ν</b></td>
<td width=200px;><b>μ°λ½μ²</b></td>
</tr>
<c:forEach var="list" items="${reservationList }">
<tr>
<td><input type="checkbox" id="check" name="res_num" value="${list.num }" onclick="check(this.form)" /></td>
<td height=50px;><a href="${pageContext.request.contextPath }/animalMemberViewAction2.am">${list.animal_name }</a></td>
<!-- <td><input type="hidden" name="animal_name" value="${list.animal_name }"></td> -->
<td height=50px;>${list.kind }</td>
<!-- <td><input type="hidden" name="subject" value="${list.subject }"></td> -->
<td height=50px;>${list.subject }</td>
<!-- <td><input type="hidden" name="subject" value="${list.subject }"></td> -->
<td height=50px;>${list.dateS }</td>
<!-- <td></td> -->
<td height=50px;>${list.etc }</td>
<!-- <td><input type="hidden" name="etc" value="${list.etc }"></td> -->
<td height=50px;>${list.phone }</td>
<!-- <td><input type="hidden" name="phone" value="${list.phone }"></td> -->
</tr>
</c:forEach>
</table>
<br> <br>
<table class="table1" align="center">
<tr>
<td><button type="button" class="btn btn-outline-info btn-lg">
<a href="javascript:history.back()" style="color:skyblue">λμκ°κΈ°</a>
</button></td>
<td><button type="button" class="btn btn-outline-info btn-lg"
onclick="document.remove.submit();">μμ½μ·¨μ</button></td>
</tr>
</table>
<br>
</form>
</div>
<!-- <c:if test="${list == null }">
<section class="div_empty">
μμ½ μ λ³΄κ° μμ΅λλ€.
</section>
</c:if> -->
<!-- footer -->
<jsp:include page="/footer_ad.jsp"></jsp:include>
<!-- END footer -->
</body>
</html>
ν¬μΈνΈλ 체ν¬λ°μ€λ₯Ό PK λ°°μ΄ κ°μΌλ‘ λ°λ κ²μ΄μλ€
λ°μν