BCSL 057
BCSL 057
Ltd
9 6 0 2
1 7 9 1 0 0 9 7 7
Sudeep Karanjit
House No.191, Navasudhar galli
Gangahiti, Chabahil-7, Kathmandu, Nepal
BCA
BCSL- 057
Web Programming Lab
English
BCA(5)/057/Assignment/2019-20
QNo 1. a) Solution:
i) INDEX/HOME PAGE:
HTML CODE:
<html>
<head>
<title>Online banking of ABC bank</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="main">
<div id="header_element">
<img src="abc.png">
<h1>Online Banking</h1>
<div id="menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Account_Balance.html">Account Balance</a></li>
<li><a href="transaction.html">Transactions</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
<div class="clear"></div>
</div>
<div id="content_area">
<div id="options_divsion">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Account_Balance.html">Account Balance</a></li>
<li><a href="transaction.html">Transactions</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
<div class="clear"></div>
</div>
<div id="data_division">
<form action="#" method="post" id="login_form">
<label><center><h4>Login Here</h4></center></label>
<div>
<label>Username </label>
<input type="text" name="username" id="username" required>
</div>
<div>
<label>Password </label>
<input type="Password" name="Password" id="Password" required>
</div>
<div><button type="submit" id="btn_submit">Submit</button></div>
</form>
</div>
<div class="clear"></div>
</div>
<div id="crypt">
<center><p> © online banking is copyright of ABC Bank</p></center>
</div>
</div>
</body>
</html>
ii) Account Balance Page
HTML CODE:
<html>
<head>
<title>Online banking of ABC bank</title>
<link rel="stylesheet" href="style.css">
<script>
function validateForm() {
var x = document.forms["login"]["username"].value;
var y = document.forms["login"]["password"].value;
var n = y.length;
if (x == "") {
alert("must enter username");
return false;
}
if (y == ""){
alert(" must enter password");
return false;
}
if ( n <= 4) {
alert(" password must be more than 4 characters");
return false;
}
}
</script>
</head>
<body>
<div id="main">
<div id="header_element">
<img src="abc.png">
<h1>Online Banking</h1>
<div id="menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Account_Balance.html">Account Balance</a></li>
<li><a href="transaction.html">Transactions</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
<div class="clear"></div>
</div>
<div id="content_area">
<div id="options_divsion">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Account_Balance.html">Account Balance</a></li>
<li><a href="transaction.html">Transactions</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
<div class="clear"></div>
</div>
<div id="data_division">
<form name="login" action="#" method="post" id="login_form" onsubmit="return
validateForm()" >
<label><center><h4>Login Here</h4></center></label>
<div>
<label>Username </label>
<input type="text" name="username" id="username">
</div>
<div>
<label>Password </label>
<input type="Password" name="password" id="password">
</div>
<div><button type="submit" id="btn_submit">Submit</button></div>
</form>
</div> <div class="clear"></div>
</div>
<div id="crypt">
<center><p> © online banking is copyright of ABC Bank</p></center>
</div>
</div>
</body>
</html>
iii) Transactions Page
HTML Code:
<html>
<head>
<title>Online banking of ABC bank</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="main">
<div id="header_element">
<img src="abc.png">
<h1>Online Banking</h1>
<div id="menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Account_Balance.html">Account Balance</a></li>
<li><a href="transaction.html">Transactions</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
<div class="clear"></div>
</div>
<div id="content_area">
<div id="options_divsion">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Account_Balance.html">Account Balance</a></li>
<li><a href="transaction.html">Transactions</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
<div class="clear"></div>
</div>
<div id="data_division">
<table class="greyGridTable">
<thead>
<tr>
<th>Date</th>
<th>Description</th>
<th>Amount</th>
<th>Tran.Type</th>
<th>Tran. No</th>
</tr>
</thead>
<tbody>
<tr>
<td>cell1_1</td>
<td>cell2_1</td>
<td>cell3_1</td>
<td>cell4_1</td>
<td>cell5_1</td>
</tr>
<tr>
<td>cell1_2</td>
<td>cell2_2</td>
<td>cell3_2</td>
<td>cell4_2</td>
<td>cell5_2</td>
</tr>
<tr>
<td>cell1_3</td>
<td>cell2_3</td>
<td>cell3_3</td>
<td>cell4_3</td>
<td>cell5_3</td>
</tr>
</tbody>
</table>
<div id="balance_display">
<h4>Opening Balance : </h4> <h5>Nrs.10000</h5>
<br>
<h4>Closing Balance : </h4> <h5>Nrs.15000</h5>
</div>
</div>
<div class="clear"></div>
</div>
<div id="crypt">
<center><p> © online banking is copyright of ABC Bank</p></center>
</div>
</div>
</body>
</html>
iv) Feedback Page
HTML CODE:
<html>
<head>
<title>Online banking of ABC bank</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="main">
<div id="header_element">
<img src="abc.png">
<h1>Online Banking</h1>
<div id="menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Account_Balance.html">Account Balance</a></li>
<li><a href="transaction.html">Transactions</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
<div class="clear"></div>
</div>
<div id="content_area">
<div id="options_divsion">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="Account_Balance.html">Account Balance</a></li>
<li><a href="transaction.html">Transactions</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
<div class="clear"></div>
</div>
<div id="data_division">
<form action="#" method="post" id="feedback_form">
<h4>Feedback</h4>
<label>Message </label>
<textarea type="textarea" name="message" id="message_box" >your message here !!</textarea>
<div><button type="submit" id="msg_submit">Submit</button></div>
</form>
</div>
<div class="clear"></div>
</div>
<div id="crypt">
<center><p> © online banking is copyright of ABC Bank</p></center>
</div>
</div>
</body>
</html>
@charset "utf-8";
/* CSS Document for BCSL 057 */
body { font: sans-serif; font-size: 14px/16px; font-weight: normal; background: #fff; color: #2822a6; margin: 0; padding:
0;}
.clear{clear: both;}
#main {background: #eee; clear: both; width: 80%; margin: 50px auto; padding: 30px 0; border:1px solid #333;}
#header_element{ margin: 0 auto; padding:5% 10% 0; clear: both; }
#header_element img {width:50px; height: 50px; float: left;}
#header_element h1 {font-size: 20px/22px; color:#333; float: left; margin: 0 10%;}
#menu { float: left; border: 4px solid #333; width: 99%; }
#menu ul { float: left; display: inline-block; }
#menu ul li {float: left; text-decoration: none; display: inline; margin: 0 20px;}
#content_area {margin: 0 auto; padding: 0 10%; clear: both;}
#options_divsion { float: left; margin: 5px 0; width: 20%; border:5px solid #333; min-height:285px;}
#options_divsion ul { margin: 0; padding: 10px; }
#options_divsion ul li { margin: 10px; padding: 10px; text-decoration: none; list-style: none; }
#data_division { float: right; background: #fff; margin: 5px 0; padding:30px; width: 70%; border:5px solid #333; min-
height: 222px;}
#login_form {width:65%; margin:0 auto; border: 2px solid #333;}
#data_division form h4 { font-family: Arial, Helvetica, sans-serif; font-size: 20px/21px; font-weight: bold; margin: 15px
auto; padding: 0; }
#data_division form div {margin: 10px auto; width: 50%;}
#feedback_form {width: 100%; margin: 0; padding: 0;}
#feedback_form label {font: bold 18px/20px Arial, Helvetica, sans-serif; margin: 0 15px 0 0; width:150px ; display: inline-
block ; }
#feedback_form input { width:400px; }
#feedback_form textarea {width: 400px; height: 100px; position: relative; top: 40px; }
#feedback_form #msg_submit { margin:0; padding: 0; width: 100px; position: relative; left: 315px; top:35px;}
#btn_submit{margin: 20px auto;}
#crypt {width:79%; margin:0 auto; border:5px solid #333;}
#balance_display {background: #3faf5a;}
#balance_display h4,h5 {font: 18px/20px bold Arial; display: inline;}
table.greyGridTable {
font-family: Arial, Helvetica, sans-serif;
border: 3px solid #414141;
width: 100%;
text-align: center;
border-collapse: collapse;
}
table.greyGridTable td, table.greyGridTable th {
border: 3px solid #414141;
padding: 3px 3px;
}
table.greyGridTable tbody td {
font-size: 13px;
color: #333333;
}
table.greyGridTable thead {
border-bottom: 4px solid #333333;
}
table.greyGridTable thead th {
font-size: 15px;
font-weight: bold;
color: #333333;
text-align: center;
border-left: 2px solid #333333;
}
table.greyGridTable thead th:first-child {
border-left: none;
}
table.greyGridTable tfoot td {
font-size: 14px;
}
<script>
function validateForm() {
var x = document.forms["login"]["username"].value;
var y = document.forms["login"]["password"].value;
var n = y.length;
if (x == "") {
alert("must enter username");
return false;
}
if (y == ""){
alert(" must enter password");
return false;
}
if ( n <= 4) {
alert(" password must be more than 4 characters");
return false;
}
}
</script>
QNo1. d)
Verify Login
package g;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class verifyLogin1 {
ResultSet rs=ps.executeQuery();
status=rs.next();
} catch (SQLException e) {
e.printStackTrace();
}
return status;
}
}
Database initializer
package g;
con=DriverManager.getConnection(DBIntializer.CON_STRING,DBIntializer.USERNAME,DBIntializer.PASSWORD);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
System.out.println("Exception in GetCon");
}
}
public static Connection getCon(){
return con;
}
ResultSet rs=ps2.executeQuery();
rs.next();
nextvalue=rs.getInt(1);
} catch (SQLException e) {
e.printStackTrace();
}
return nextvalue;
}
}
CreateServlet.java
package g;
import java.io.IOException;
import java.io.PrintWriter;
import java.rmi.Naming;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String username=request.getParameter("username");
String password=request.getParameter("password");
String repassword=request.getParameter("repassword");
String amoun=request.getParameter("amount");
double amount=Double.parseDouble(amoun);
String adderess=request.getParameter("adderess");
String ph=request.getParameter("phone");
double phone=Double.parseDouble(ph);
//double mname=Double.parseDouble(num);
//String country=request.getParameter("country");
if(status>0){
out.print("WELCOME! YOUR ACCOUNT HAS OPENED");
RequestDispatcher rd=request.getRequestDispatcher("index.jsp");
rd.include(request, response);
}
else{
out.print("Sorry,Registration failed. please try later");
RequestDispatcher rd=request.getRequestDispatcher("MyHtml.html");
rd.include(request, response);
}
out.close();
}
try{
con=GetCon.getCon();
PreparedStatement ps1=con.prepareStatement("Select * from NEWACCOUNT");
try{
status=ps1.executeUpdate();
}
catch(Exception e)
{e.printStackTrace();
status=2;
System.out.println("my staus is1111111"+status);
}
if(status==0)
{System.out.println("your table name already exist"+status);}
else if(status==2)
{System.out.println("else if part table does not exist new table has created"+status);
PreparedStatement ps3=con.prepareStatement("CREATE SEQUENCE javatpointnewaccount MINVALUE 1
MAXVALUE 999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE");
ps3.executeUpdate();
}
}