forked from kirannegi0149/Employee-Management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch-record.jsp
179 lines (171 loc) · 4.82 KB
/
search-record.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color:rgba(240,243,236,255);
color: #333;
}
table {
margin: 50px auto;
border-collapse: collapse;
width: 40%;
background: #c9cfd2;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
overflow: hidden;
}
th, td {
padding: 15px 20px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
color: black;
text-align: center;
font-size: 1.2em;
}
tr:hover {
background-color: #f1f1f1;
}
button {
background-color: #dc3545;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1em;
}
button:hover {
background-color: #c82333;
}
.dvv {
margin: 40px auto;
width: 70%;
text-align: center;
padding: 10px;
background: #dde3df;
border: 1px solid #f5c6cb;
color: #721c24;
font-size: 1.2em;
border-radius: 5px;
table {
margin: 50px auto;
border-collapse: collapse;
width: 40%;
background: #c9cfd2;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
overflow: hidden;
}
th, td {
padding: 15px 20px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
color: black;
text-align: center;
font-size: 1.2em;
}
tr:hover {
background-color: #f1f1f1;
}
button {
background-color: #dc3545;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1em;
}
button:hover {
background-color: #c82333;
}
.dvv {
margin: 40px auto;
width: 70%;
text-align: center;
padding: 10px;
background: #dde3df;
border: 1px solid #f5c6cb;
color: #721c24;
font-size: 1.2em;
border-radius: 5px;
} @media screen and (max-width: 768px) {
table.tar, .dvv {
width: 80%;
}
table.tar th, table.tar td {
font-size: 13px;
}
.dvv label {
font-size: 1rem;
}
}
</style>
</head>
<body onload="makeActive('search')">
<%
// Fetching Employee ID from the database
String eid = request.getParameter("eid");
// Loading Driver Class
Class.forName("com.mysql.cj.jdbc.Driver");
// Creating Connection
Connection cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jsp10", "root", "mysqlkiran011");
PreparedStatement ps = cn.prepareStatement("select * from employeeinfo where eid=?");
ps.setString(1, eid);
ResultSet rst = ps.executeQuery();
if (rst.next()) {
%>
<%@include file ="navbar.jsp" %>
<table class='tar'>
<tr>
<th colspan="2" style="color:white; font-size:20px; background-color:#565a62;">Employee Details</th>
</tr>
<tr>
<th>Employee ID</th>
<td><%= eid %></td>
</tr>
<tr>
<th>First Name</th>
<td><%= rst.getString(2) %></td>
</tr>
<tr>
<th>Last Name</th>
<td><%= rst.getString(3) %></td>
</tr>
<tr>
<th>Phone Number</th>
<td><%= rst.getString(4) %></td>
</tr>
<tr>
<th>Department</th>
<td><%= rst.getString(5) %></td>
</tr>
<tr>
<th>emailid</th>
<td><%= rst.getString(6) %></td>
</tr>
<tr>
<th>Salary</th>
<td>₹<%= rst.getString(7) %></td>
</tr>
</table>
<%
} else {
%>
<jsp:include page="search.jsp" />
<div class='dvv'>
<label>Employee record with ID <%= eid %> not found</label>
</div>
<%
}
%>
</body>
</html>