-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschool.jsp
286 lines (258 loc) · 6.24 KB
/
school.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
table,th,td {
border: 1px solid black;
border-collapse: collapse;
}
th,td {
padding: 15px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>School</title>
</head>
<body style = "background-color: mintcream;">
<%!
String Name;
String FatherName;
String Dob;
String Sex;
String Ref_ID;
String Address;
String School_name;
String Tuit_fee;
String Tuit_fee_status;
String Hostel_fee;
String Hostel_fee_status;
String Trans_fee;
String Trans_fee_status;
String Scholarship;
String Scholarship_awarded;
%>
<%
Connection con = null;
PreparedStatement ps = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
ResultSet rs3 = null;
ResultSet rs4 = null;
ResultSet rs5 = null;
ResultSet rs6 = null;
String driverName = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/project";
String user = "root";
String dbpsw = "robert8472";
String sql2="select * from sinfo where ref_id="+session.getAttribute("id");
String sql3="select * from tuit_fee where ref_id="+session.getAttribute("id");
String sql4="select * from hostel_fee where ref_id="+session.getAttribute("id");
String sql5="select * from trans_fee where ref_id="+session.getAttribute("id");
String sql6="select * from sship where ref_id="+session.getAttribute("id");
try
{
java.lang.Class.forName(driverName + "");
con = DriverManager.getConnection(url, user, dbpsw);
Statement stmt = con.createStatement();
ps = con.prepareStatement(sql2);
rs1 = ps.executeQuery(sql2);
if(rs1.next())
{
Ref_ID = rs1.getString("ref_id");
Name = rs1.getString("name");
FatherName = rs1.getString("fname");
Dob = rs1.getString("dob");
Sex = rs1.getString("sex");
Address = rs1.getString("address");
School_name = rs1.getString("school");
}
else
response.sendRedirect("error.jsp");
rs1.close();
ps.close();
}
catch(SQLException sqe)
{
out.println(sqe);
}
%>
<p style="font-family: trebuchet; color:navy; font-size: 25px;"><b><i> Welcome, <%out.println(Name); %> </i></b></p>
<center><h2 style="font-family: georgia; color:crimson; font-size: 20px;"> <b><i> Student Information </i> </b> </h2></center>
<table align="center">
<tr>
<td>Name :</td>
<td><b><%out.println(Name); %></b></td>
<td>Father's Name :</td>
<td><b><%out.println(FatherName); %></b></td>
</tr>
<tr>
<td>Date of Birth :</td>
<td><b><%out.println(Dob); %></b></td>
<td>Sex :</td>
<td><b><%out.println(Sex); %></b></td>
</tr>
<tr>
<td>Reference ID :</td>
<td><b><%out.println(Ref_ID);%></b></td>
<td>Address :</td>
<td><b><%out.println(Address); %></b></td>
</tr>
<tr>
<td>School :</td>
<td><b><%out.println(School_name);%></b></td>
<td>--</td>
<td>--</td>
</tr>
</table><br>
<center><h2 style="font-family: serif; color: green; font-size: 25px;"> <b> <i> Billing Information </i></b></h2></center>
<%
try
{
java.lang.Class.forName(driverName + "");
con = DriverManager.getConnection(url, user, dbpsw);
Statement stmt= con.createStatement();
ps = con.prepareStatement(sql3);
rs2 = ps.executeQuery(sql3);
if(rs2.next())
{
Tuit_fee = rs2.getString("amount");
Tuit_fee_status = rs2.getString("status");
}
else
response.sendRedirect("error.jsp");
rs2.close();
ps.close();
}
catch(SQLException sqe)
{
out.println(sqe);
}
%>
<%
try
{
java.lang.Class.forName(driverName + "");
con = DriverManager.getConnection(url, user, dbpsw);
Statement stmt= con.createStatement();
ps = con.prepareStatement(sql4);
rs3 = ps.executeQuery(sql4);
if(rs3.next())
{
Hostel_fee = rs3.getString("amount");
Hostel_fee_status = rs3.getString("status");
}
else
response.sendRedirect("error.jsp");
rs3.close();
ps.close();
}
catch(SQLException sqe)
{
out.println(sqe);
}
%>
<%
try
{
java.lang.Class.forName(driverName + "");
con = DriverManager.getConnection(url, user, dbpsw);
Statement stmt= con.createStatement();
ps = con.prepareStatement(sql5);
rs4 = ps.executeQuery(sql5);
if(rs4.next())
{
Trans_fee = rs4.getString("amount");
Trans_fee_status = rs4.getString("status");
}
else
response.sendRedirect("error.jsp");
rs4.close();
ps.close();
}
catch(SQLException sqe)
{
out.println(sqe);
}
%>
<%
try
{
java.lang.Class.forName(driverName + "");
con = DriverManager.getConnection(url, user, dbpsw);
Statement stmt= con.createStatement();
ps = con.prepareStatement(sql6);
rs5 = ps.executeQuery(sql6);
if(rs5.next())
{
Scholarship = rs5.getString("amount");
Scholarship_awarded = rs5.getString("awarded");
}
else
response.sendRedirect("error.jsp");
rs5.close();
ps.close();
}
catch(SQLException sqe)
{
out.println(sqe);
}
%>
<form action="payment2.jsp" method="post">
<table align="center">
<tr>
<td><b><i>Types of fees</i></b></td>
<td><b><i>Bill Amount</i></b></td>
<td><b><i>Status</i></b></td>
<td><b><i>Payment Selection</i></b></td>
</tr>
<tr>
<td>Tuition Fee </td>
<td><b><%out.println(Tuit_fee); %></b></td>
<td><%out.println(Tuit_fee_status); %></td>
<td>
<% if(Tuit_fee_status.equals("unpaid")){%>
<input type="checkbox" name="Payment" value="Tuition">Select
<%}
else
%></td>
</tr>
<tr>
<td>Hostel Fee </td>
<td><b><%out.println(Hostel_fee); %></b></td>
<td><%out.println(Hostel_fee_status); %></td>
<td>
<% if(Hostel_fee_status.equals("unpaid")){%>
<input type="checkbox" name="Payment" value="Hostel">Select
<%}
else
%></td>
</tr>
<tr>
<td>Transport Fee </td>
<td><b><%out.println(Trans_fee); %></b></td>
<td><%out.println(Trans_fee_status); %></td>
<td>
<% if(Trans_fee_status.equals("unpaid")){%>
<input type="checkbox" name="Payment" value="Transport">Select
<%}
else
%></td>
</tr>
<tr>
<td> Scholarship </td>
<td><b><%out.println(Scholarship); %></b></td>
<td>
<% if(Scholarship_awarded.equals("no")){%>
<input type="hidden" name="Payment" value="Scholarship">
<% }
else %>
</td>
<td>--</td>
</tr>
</table><br>
<center><input type="submit" value="Pay"></center></form>
</body>
</html>