-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSBIPage2.jsp
85 lines (79 loc) · 2.29 KB
/
SBIPage2.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
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="UTF-8"%>
<%@ page import = "javax.servlet.RequestDispatcher" %>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%!
String[] billname;
String balance;
String Ref_ID;
%>
<%
Connection con = null;
PreparedStatement ps1 = null;
PreparedStatement ps2 = null;
ResultSet rs1 = null;
String driverName = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/project";
String user = "root";
String dbpsw = "robert8472";
String sql="select * from sbiinfo where ref_id="+session.getAttribute("id");
try
{
java.lang.Class.forName(driverName + "");
con = DriverManager.getConnection(url, user, dbpsw);
Statement stmt= con.createStatement();
ps1 = con.prepareStatement(sql);
rs1 = ps1.executeQuery(sql);
if(rs1.next())
{
Ref_ID=rs1.getString("ref_id");
balance= rs1.getString("balance");
}
else
response.sendRedirect("error.jsp");
rs1.close();
ps1.close();
}
catch(SQLException sqe)
{
out.println(sqe);
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> SBI Home </title>
</head>
<body>
<center><h4 style="color: indigo; ">You opted to pay ₹ <%=request.getParameter("Total_Bill") %></h4><br>
<p style="color: indigo; ">Current balance in your account is ₹ <%=balance %></p>
</center>
<%
int bill = Integer.parseInt(request.getParameter("Total_Bill"));
billname = request.getParameterValues("BillName");
int SBIbalance = Integer.parseInt(balance);
if(SBIbalance >= bill)
{
%>
<center><form action="SBI_Interface2.jsp">
<%
for(int i=0;i<billname.length;i++)
{
%>
<input name="BillName" type="hidden" value=<%=billname[i] %>><%
}
%>
<input name="SBIPayment" type="hidden" value="Success">
<input name="Update" type ="hidden" value=<%=request.getParameter("Total_Bill")%>>
<input type="submit" value="Confirm payment"></form></center>
<%}
else
{ %>
<center><h3 style="color: indigo;"> Your bank account doesn't have sufficient balance.
Hence, payment couldn't be completed.</h3></center>
<% } %>
<br>
<center><a href="school.jsp"> Back </a></center>
</body>
</html>