-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBookClubModifyOk.jsp
32 lines (29 loc) · 1.19 KB
/
BookClubModifyOk.jsp
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
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*, java.text.*" %>
<html>
<head><title>게시판 내용 수정 처리</title></head>
<body>
<%
String DB_URL="jdbc:mysql://localhost:3306/internetproject";
String DB_ID="multi";
String DB_PASSWORD="abcd";
Class.forName("com.mysql.cj.jdbc.Driver");
Connection con = DriverManager.getConnection(DB_URL, DB_ID, DB_PASSWORD);
request.setCharacterEncoding("UTF-8");
String postId = request.getParameter("postId");
String title = request.getParameter("title");
String content = request.getParameter("content");
String jsql = "update clubpost set title = ?, content = ? where postId = ?";
PreparedStatement pstmt = con.prepareStatement(jsql);
pstmt.setString(1, title);
pstmt.setString(2, content);
pstmt.setInt(3, Integer.parseInt(postId));
pstmt.executeUpdate();
%>
<script>
alert("게시물 수정이 완료되었습니다.");
location.href = "BookClub.jsp?clubId=1"
</script>
</body>
</html>