-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathadmin_faculty_requests_action.jsp
More file actions
42 lines (36 loc) · 1007 Bytes
/
Copy pathadmin_faculty_requests_action.jsp
File metadata and controls
42 lines (36 loc) · 1007 Bytes
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
<%@ page language="java" import="java.sql.*"%>
<%
String c[]= request.getParameterValues("ad");
try
{
// register the driver
Class.forName("com.mysql.cj.jdbc.Driver");
// establish the connection with the database
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/project" , "root" , "Mypasswordis2425");
// create a SQL statement
Statement stmt = con.createStatement();
// if delete request is made
if(request.getParameter("reject") != null)
{
for(String s:c)
{
String qy = "delete from faculty where subject ='" + s + "'";
stmt.executeUpdate(qy);
}
}
// else if accept request is made
else if(request.getParameter("accept") != null)
{
for(String s:c)
{
String qy = "update faculty set is_approved = 1 where subject ='" + s + "'";
stmt.executeUpdate(qy);
}
}
}
catch(Exception e)
{
out.println(e.getMessage());
}
response.sendRedirect("admin_faculty_requests.jsp"); // redirect to requsts' page
%>