/
admin.jsp
66 lines (53 loc) · 1.91 KB
/
admin.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
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
<%--
Document : admin
Created on : May 6, 2016, 10:53:20 AM
Author : priya_jw1v0e1
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css1.css">
<title>Admin Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<header class="2">
<center><h1> Administrator </h1><center>
</header>
</head>
<script>
function fun1()
{window.location="update.html";
}
function fun2()
{window.location="delete.html";
}
function logout()
{
alert("Successfully logged out!!");
window.location="index.html";
}
</script>
<body>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con =DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","");
String sql="select * from project";
Statement st = con.createStatement();
ResultSet rs;
rs=st.executeQuery(sql);
out.println("<table border=1px ><tr><th>S.no</th><th>Users Registered</th>");
int count=1;
while(rs.next()){
out.println("<tr><td>"+count+"</td><td>"+rs.getString(1)+"</td></tr>");
count++;
}
out.println("</table><center>");
out.println("<input type=\"button\" onclick=\"fun1()\" value=\"update\">");
out.println("<input type=\"button\" onclick=\"fun2()\" value=\"delete\"><center>");
out.println("<input type=\"button\" onclick=\"logout()\" value=\"Logout\"><center>");
st.close();
con.close();
%>
</body>
</html>