๋ฐ์ํ
ํ ๋ช ์ ํ์์ด ์ฌ๋ฌ๋ฒ ์์ฝ์ ํ์ ๋
์์ฝ์ ์ ํํด์ ์ทจ์ํ ์ ์๊ฒ ๊ตฌํํ์๋ค
โ
โ
โโ
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 ๋ฐฐ์ด ๊ฐ์ผ๋ก ๋ฐ๋ ๊ฒ์ด์๋ค
๋ฐ์ํ
'ํ๋ก์ ํธ ๊ธฐ๋ก' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
2020/10/8 ํ๋ก์ ํธ ๊ธฐ๋ก (0) | 2021.02.15 |
---|---|
2020/10/5 ํ๋ก์ ํธ ๊ธฐ๋ก (0) | 2021.02.15 |
2020/9/9 ํ๋ก์ ํธ ๊ธฐ๋ก (0) | 2021.02.15 |
select๋ฌธ ํ ์คํธ์ฉ ์์ค (0) | 2021.02.15 |
JQuery๋ก ์์ฝ ์๊ฐ ์กฐ์ (0) | 2021.02.15 |
๋๊ธ