-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateAlert.jsp
39 lines (31 loc) · 1.07 KB
/
createAlert.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
33
34
35
36
37
38
39
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body style="background-color:#F0F8FF;">
<%
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://group31.cwwhhyxvfxql.us-east-2.rds.amazonaws.com:3306/group31","Yuchen_jin","Jinyuchen2016*");
int id = Integer.parseInt(request.getParameter("account_id"));
int iid = Integer.parseInt(request.getParameter("item_id"));
String insert = "INSERT INTO Alert(item_id, eaccount_id)"
+ "VALUES (?, ?)";
PreparedStatement ps = con.prepareStatement(insert);
ps.setInt(1, iid);
ps.setInt(2, id);
ps.executeUpdate();
out.println("Alert created!");
} catch (Exception ex) {
out.print(ex);
out.print("failed to make alert");
}
%>
</body>
</html>