jsp 회원등록,수정,삭제,리스트(CRUD) 로직 구현하기 예약페이지 예약
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
protected void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
String uri = request.getRequestURI();
System.out.println("uri:"+uri);
String pj = request.getContextPath();
System.out.println(pj);
String command = uri.substring(pj.length());
System.out.println("command:"+command);
if(command.equals("/res/rescontent.do")) {
RequestDispatcher rd = request.getRequestDispatcher("/res/rescontent.jsp");
rd.forward(request, response);
}else if(command.equals("/res/rescontentAction.do")) {
System.out.println("예약 페이지 입성");
String Name = request.getParameter("Name");
System.out.println("Name =" +Name);
String respeople = request.getParameter("respeople");
int Respeople = Integer.parseInt(respeople);
System.out.println("Respeople =" + Respeople);
//금액
String rvprice1 = request.getParameter("sell_price");
int rvprice = Integer.parseInt(rvprice1);
String rvpricesum1 = request.getParameter("sum");
int rvpricesum = Integer.parseInt(rvpricesum1);
//예약일
String dataA = request.getParameter("dataA");
System.out.println("dataA ="+ dataA);
String data = request.getParameter("data");
System.out.println("data =" +data);
HttpSession session = request.getSession();
int midx = (int) session.getAttribute("midx");
System.out.println("midx ="+midx);
String membername = (String)session.getAttribute("membername");
System.out.println("membername ="+membername);
ResDao rd = new ResDao();
int value = rd.insertRes(Name, Respeople,dataA, data, midx, membername,rvprice,rvpricesum);
System.out.println("value =" +value);
if(value==1) {
session.setAttribute("Name", Name);
session.setAttribute("sum", rvpricesum);
response.sendRedirect(request.getContextPath()+"/res/pay.do");
}else {
response.sendRedirect(request.getContextPath()+"/res/rescontent.do");
}
|
cs |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
public int insertRes(String rvname,int Respeople,String dataA,String data,int midx,String membername,int rvprice,int rvpricesum) {
int value=0;
PreparedStatement pstmt = null;
String sql = "insert into reservation(ridx,rvname,rvpeople,writedayA,writeday,midx,membername,rvprice,rvpricesum)"
+"values(ridx_b_seq.NEXTVAL,?,?,?,?,?,?,?,?)";
try {
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, rvname);
pstmt.setInt(2, Respeople);
pstmt.setString(3, dataA);
pstmt.setString(4, data);
pstmt.setInt(5, midx);
pstmt.setString(6, membername);
pstmt.setInt(7, rvprice);
pstmt.setInt(8, rvpricesum);
value=pstmt.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("value =" +value);
return value;
}
|
cs |
'기존 > 🏀Jsp' 카테고리의 다른 글
[JSP] 아이템 구매 로직 구현 (0) | 2022.05.31 |
---|---|
[JSP]예약한거 LIST 구현 (예약리스트구현) (0) | 2022.05.31 |
[JSP] 게시판 조회수 구현 (0) | 2022.05.31 |
[JSP] 게시판 답변달기 구현하기 (0) | 2022.05.31 |
[JSP] 게시판 삭제 구현하기 (0) | 2022.05.31 |