Thursday, 3 September 2015

BCSL-057 Web Programming Lab 2015-2016

1. Create a website for a Bank having the following features (you must use CSS preferably
as a separate file):
Ans:
Html Files

Home.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="css1.css">
</head>
<body>
<table width="100%">
<tr>
<td colspan="2" class="top"><span><img src="image\logo1.png"><span> CUSTOMER PAID
BANK LTD.<span style="font-size:20px;padding:5px 45px">[Uttam Nagar]</span></td>
</tr>
<tr>
<td class="left">
<div id="nav">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="service.html">Bank Services</a></li>
<li><a href="branch.html">Bank Branches</a></li>
<li><a href="complain.html">Customer Complain</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
</td>
<td class="right">
<h1> About Our Bank</h1> <p>Customer Paid Bank(CPB) is a public sector banking company
headquartered in Mangalore, India. The bank has pan-India presence with 8,000 functional units
comprising 3200 branches, 3200+ ATMs and 4,000 branchless banking units as of 30 January
2015.</td>
</tr>

<tr>
<td class="bottom">Don't disclose your PIN/Password to any one. Bank is not responsible for
online transactions going wrong.PLEASE NOTE THAT OUR BANK NEVER ASKS FOR
SUCH DETAILS AT ANY TIME.BEWARE OF FAKE MOBILE CALLS FROM PERSONS
PRETENDING TO BE FROM OUR BANK
<br>[ Last Update on 29th Aug, 2015 ]</td>
</tr>
</table>
</body>

Service.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="css1.css">
</head>
<body>
<table width="100%">
<tr>
<td colspan="2" class="top"><span><img src="image\logo1.png"><span> CUSTOMER PAID
BANK LTD.<span style="font-size:20px;padding:5px 45px">[Uttam Nagar]</span></td>
</tr>
<tr>
<td class="left">
<div id="nav">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="service.html">Bank Services</a></li>
<li><a href="branch.html">Bank Branches</a></li>
<li><a href="complain.html">Customer Complain</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
</td>
<td class="right">
<h1> Our Services</h1> <p>
<ol>
<li>Beti Suraksha Yogna
<li>Fixed deposit
<li>Moneyflex Deposit
<li>Recurring Deposit
<li>Locker Facility
<li>Tax Payments
<li>E-payments
<li>Depositary Services
<li>Bills and Shopping
</td>
</tr>
<tr>
<td class="bottom">Don't disclose your PIN/Password to any one. Bank is not responsible for
online transactions going wrong.PLEASE NOTE THAT OUR BANK NEVER ASKS FOR
SUCH DETAILS AT ANY TIME.BEWARE OF FAKE MOBILE CALLS FROM PERSONS
PRETENDING TO BE FROM OUR BANK
<br>[ Last Update on 29th Aug, 2015 ]</td>
</tr>
</table>
</body>

Branch.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="css1.css">
</head>
<body>
<table width="100%">
<tr>
<td colspan="2" class="top"><span><img src="image\logo1.png"><span> CUSTOMER PAID
BANK LTD.<span style="font-size:20px;padding:5px 45px">[Uttam Nagar]</span></td>
</tr>
<tr>
<td class="left">
<div id="nav">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="service.html">Bank Services</a></li>
<li><a href="branch.html">Bank Branches</a></li>
<li><a href="complain.html">Customer Complain</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
</td>
<td class="right">
<h1> Locate Branch</h1>
<form action="search">
<p>Enter Branch Name:<input type="text" name="bname"/><br/>
<p><input type="submit" value="Search"/>
</form>
</td>
</tr>
<tr>
<td class="bottom">Don't disclose your PIN/Password to any one. Bank is not responsible for
online transactions going wrong.PLEASE NOTE THAT OUR BANK NEVER ASKS FOR
SUCH DETAILS AT ANY TIME.BEWARE OF FAKE MOBILE CALLS FROM PERSONS
PRETENDING TO BE FROM OUR BANK
<br>[ Last Update on 29th Aug, 2015 ]</td>
</tr>
</table>
</body>

Complain.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="css1.css">
</head>
<body>
<table width="100%">
<tr>
<td colspan="2" class="top"><span><img src="image\logo1.png"><span> CUSTOMER PAID
BANK LTD.<span style="font-size:20px;padding:5px 45px">[Uttam Nagar]</span></td>
</tr>
<tr>
<td class="left">
<div id="nav">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="service.html">Bank Services</a></li>
<li><a href="branch.html">Bank Branches</a></li>
<li><a href="complain.html">Customer Complain</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
</td>
<td class="right">
<h1> Register Your Complain</h1>
<form action="cregister" method="post">
<pre>
<p>Account NO : <input type="text" name="acno"/>
<p>Cust Name : <input type="text" name="cname"/>
<p>Branch Name : <input type="text" name="bname"/>
<p>Complain : <textarea name="complain" rows="5"></textarea>
<input type="submit" value="register"/>
</pre>
</td>
</tr>
<tr>
<td class="bottom">Don't disclose your PIN/Password to any one. Bank is not responsible for
online transactions going wrong.PLEASE NOTE THAT OUR BANK NEVER ASKS FOR
SUCH DETAILS AT ANY TIME.BEWARE OF FAKE MOBILE CALLS FROM PERSONS
PRETENDING TO BE FROM OUR BANK
<br>[ Last Update on 29th Aug, 2015 ]</td>
</tr>
</table>
</body>

Feedback.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="css1.css">
<script language="javascript">
function validate()
{
var i,y;
var x=f1.acno.value
for(i=0;i<x.length;i++)
{
if(x.charAt(i)>="0" && x.charAt(i)<="9")
y=0
else
y=1;
}
if(y==1)
{
alert("invalid Account");
f1.acno.value=""
f1.acno.focus();
}
}
</script>
</head>
<body>
<table width="100%">
<tr>
<td colspan="2" class="top"><span><img src="image\logo1.png"><span> CUSTOMER PAID
BANK LTD.<span style="font-size:20px;padding:5px 45px">[Uttam Nagar]</span></td>
</tr>
<tr>
<td class="left">
<div id="nav">
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="service.html">Bank Services</a></li>
<li><a href="branch.html">Bank Branches</a></li>
<li><a href="complain.html">Customer Complain</a></li>
<li><a href="feedback.html">Feedback</a></li>
</ul>
</div>
</td>
<td class="right">
<h1> Register Your Complain</h1>
<form action="cregister" method="post" name="f1">
<pre>
<p>Account NO : <input type="text" name="acno"/ onblur="validate()">
<p>Cust Name : <input type="text" name="cname"/>
<p>Branch Name : <input type="text" name="bname"/>
<p>Message : <textarea name="complain" rows="5"></textarea>
<input type="submit" value="register"/>
</pre>
</td>
</tr>
<tr>
<td class="bottom">Don't disclose your PIN/Password to any one. Bank is not responsible for
online transactions going wrong.PLEASE NOTE THAT OUR BANK NEVER ASKS FOR
SUCH DETAILS AT ANY TIME.BEWARE OF FAKE MOBILE CALLS FROM PERSONS
PRETENDING TO BE FROM OUR BANK
<br>[ Last Update on 29th Aug, 2015 ]</td>
</tr>
</table>
</body>
<html>

Database Coding in Servlet
Search.java 
import java.io.*;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
public class search extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
 throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();

String bname=request.getParameter("bname");

try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","yyyy");

PreparedStatement ps=con.prepareStatement("select * from branch where bcode=?");
ps.setString(1,bname);
out.print("<table width=50% border=1>");
ResultSet rs=ps.executeQuery();
while(rs.next())
{
out.print("<tr><td>"+rs.getStrig(1)+"</td><td>"+rs.getString(2)+"
</td><td>"+rs.getString(3)+"</td><td>"+rs.getString(4)+"</td></tr>");
}
out.print("</table>");
}catch (Exception e)
{
e.printStackTrace();
}
finally{out.close();}
}
}

Cregister.java
import java.io.*;
import java.sql.*;

import javax.servlet.ServletException;
import javax.servlet.http.*;
public class cregister extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
 throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();

String x=request.getParameter("acno");
String y=request.getParameter("cname");
String z=request.getParameter("bname");
String p=request.getParameter("complain");

try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con =
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","yyyy");
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Connection con=DriverManager.getConnection("jdbc:odbc:pixdata");

PreparedStatement ps=con.prepareStatement("insert into c_register values(?,?,?,?)");
ps.setString(1,x);
ps.setString(2,y);
ps.setString(3,z);
ps.setString(4,p);
int i=ps.executeUpdate();
if(i>0)
out.print("You are successfully registered your complain...");
}
catch (Exception e2)
{
System.out.println(e2);
}
out.close();
}
}

Css file

Css1.css
.top{
 padding: 2% 200;
 background:top repeat-x #f0fF00;
 border-bottom: solid 1px #001C32;
 font-size:30pt;
 color:#FF0066;
 font-weight:bold;
}
h1 {
 color: maroon;
 margin-left: 40px;
}
ol li,p {
 color: black;
 margin-left: 60px;
 font-size:15pt;
}
.left
{
padding: 5 5 5 5;
width:200px;
position:relative;
left:3;
background-color:#220F21;
display: block;
float: left;
height:400px;
}
.right
{
padding: 5 5 5 5;
width:70%;
position:relative;
left:3pt;
background-color:#FFFFFF;
display: block;
float: left;
}
.bottom{
 padding: 1% 100;
 background:top repeat-x #f0fF00;
 border-bottom: solid 1px #001C32;
 font-size:15pt;
 color:#FF0066;
 font-weight:bold;
 text-align:center;
}
#nav {
 font-family: verdana;
 font-weight: bold;
 font-size: 12pt;
 text-align:center;
 position:relative;
 left:0px;

}
#myspan {
 font-family: verdana;
 font-weight: bold;
 font-size: 12pt;
 text-align:center;
 position:relative;
 left:0px;

}

#nav ul {
 margin: 0;
 padding: 0;
 list-style: none;
}

#nav a:link
 {
 color: #FFFFFF;
 text-decoration: none;
}
#nav a:activate
{
text-decoration: none;
background:yellow
}
#nav a:visited
 {
 color: #FFFFFF;
 text-decoration: none;
}
#nav a {
 display: block;
 padding: 6px 8px;
}

#nav li {
 float: down;
 background-color:#FF0066;
 margin-bottom:3px;
 position: relative;
 width: 200px;
}


#nav li:hover {
 background-color:#1e6468;
}

No comments:

Post a Comment