You are on page 1of 73

BUS RESERVATION SYSTEM 1

INTRODUCTION

Bus reservation system is a IT Based Web Application that


works with in systems. This application provides bus transport system, a
facility to book tickets and cancellation of tickets when needed from the
application. It allows both the administrator and the user to check seat
availability and make reservation particularly of his/her choice.

This project enables us to reserve a bus ticket where in a


customer has been provided with many facilities like choosing his/her
own seats, destinations, departure areas, type of buses at affordable
rates. The administrator can have any information regarding the bus
reservations and cancellations.

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 2

SYSTEM REQUIREMENT

Hardware Requirement

Hard disk 250GB.


Color monitor.
Pentium Processor.
1GB RAM.
Laser printer

Software Requirement

Windows XP/Vista/7/8/8.1.
Eclipse 3.3.
Apache Tomcat server v5.5.
Internet explorer.
Google Chrome.
Mozilla Firefox.

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 3

TOOL DESCRIPTION
HTML

HTML is a computer language devised to allow website creation. These websites


can then be viewed by anyone else connected to the Internet. It is relatively easy to
learn, with the basics being accessible to most people in one sitting; and
quite powerful in what it allows you to create. It is constantly undergoing revision
and evolution to meet the demands and requirements of the growing Internet
audience under the direction of the organisation charged with designing and
maintaining the language.

The definition of HTML is Hypertext Mark-up Language.

Hypertext is the method by which you move around on the web by


clicking on special text called hyperlinks which bring you to the next page.
The fact that it is hyper just means it is not linear i.e. you can go to any
place on the Internet whenever you want by clicking on links there is no
set order to do things in.
Mark-up is what HTML tags do to the text inside them. They mark it as a
certain type of text (italicised text, for example).
HTML is a Language, as it has code-words and syntax like any other
language.

HTML consists of a series of short codes typed into a text-file by the site author
these are the tags. The text is then saved as an html file, and viewed through
a browser, like Internet Explorer or Netscape Navigator. This browser reads the
file and translates the text into a visible form, hopefully rendering the page as the
author had intended. Writing your own HTML entails using tags correctly to create
your vision. You can use anything from a rudimentary text-editor to a powerful
graphical editor to create HTML pages.

The tags are what separate normal text from HTML code. You might know them
as the words between the <angle-brackets>. They allow all the cool stuff like
images and tables and stuff, just by telling your browser what to render on the
page. Different tags will perform different functions. The tags themselves dont
appear when you view your page through a browser, but their effects do. The
simplest tags do nothing more than apply formatting to some text, like this:

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 4

<b>these words will be bold</b>, and these will not.

Cascading Stylesheets are used to control how your pages are presented, and
make pages more accessible. Basic special effects and interaction is provided
by JavaScript, which adds a lot of power to basic HTML. Most of this advanced
stuff is for later down the road, but when using all of these technologies together,
you have a lot of power at your disposal.

JSP (java server page)


JSPs have dynamic scripting capability that works in tandem with HTML code,
separating the page logic from the static elements -- the actual design and display
of the page -- to help make the HTML more functional (i.e. dynamic database
queries).
A JSP is translated into Java servlet before being run, and it processes HTTP
requests and generates responses like any servlet. However, JSP technology
provides a more convenient way to code a servlet. Translation occurs the first time
the application is run. A JSP translator is triggered by the .jsp file name extension
in a URL. JSPs are fully interoperable with servlets. You can include output from a
servlet or forward the output to a servlet, and a servlet can include output from a
JSP or forward output to a JSP.
JSPs are not restricted to any specific platform or server. It was originally created
as an alternative to Microsoft'sASPs (Active Server Pages). Recently, however,
Microsoft has countered JSP technology with its own ASP.NET, part of
the .NET initiative.

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 5

SQL SERVER

SQL is used to communicate with database .According to ANSI (American


National Standards Institute), it is the standard language for relation database
management systems .SQL statements are used to perform tasks such as such as
update data on a database, or retrieve data from a database.

SQLCMD is a command line application that comes with Microsoft SQL Server,
and exposes the management features of SQL Server. It allows SQL queries to be
written and executed from the command prompt. It can also act as a scripting
language to create and run a set of SQL statements as a script. Such scripts are
stored as a .sql file, and are used either for management of databases

T-SQL (Transact-SQL) is the Secondary means of programming and managing


SQL Server. It exposes keywords for the operations that can be performed on SQL
Server, including creating and altering database schemas, entering and editing data
in the database as well as monitoring and managing the server itself.

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 6

SCOPE OF THE PROJECT

This project enables us to reserve a bus ticket where in a customer has been
provided with many facilities like choosing his/her own seats, destinations,
departure areas, type of buses at affordable rates. The administrator can have any
information regarding the bus reservations and cancellations.

Even a normal person can visit the website but can book the tickets
through the website.He/she can even cancel or print the tickets from the
website and book tickets with zero booking charges and can get home
delivery of the tickets.

Advantages

User Friendly: The user interface of the project is very simple. So the user
doesnt require any special training.

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 7

Module Description

Login: This module is much authorized where a admin can add new travels
or update the existing travels information and also check the booking details
so that he can issue the tickets on the doorstep.

Bus Details: This module provides the user to choose his/her from and to
destination with the date on which he/she will be travelling.

Booking details: In this module we have the details of the customer like
name, from and to destination, arrival time, departure time, departure areas,
the seat numbers, phone numbers and ticket fare.

Cancellations: This module is to cancel a tickets and the fare refund will be
made after some amount of deductions as per the travel management rules.

Printing ticket: This module is used to print the tickets where a user can
print his ticket when he pays through his debit/credit card.

Search: This module allows the user to view bus details and select the bus.

Booking: In this module the user enters his/her details to book the tickets.

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 8

USE-CASE DIAGRAM

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 9

User Admin

. . Searches for
buses Add a new . .
Travels

Selects
the bus
Update any
existing travels
Fills details for
booking

View booking
details
Confirms
the booking

Print ticket

Cancel ticket

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 10

Table Description

Admin

User-id Varchar(25)

pwd Varchar(25)

Book Details
Ticketno int
Date Varchar(45)
ArrivalPlace Varchar(45)
Noseats Varchar(45)
Name Varchar(45)
Gender Varchar(45)
Age Varchar(45)
E-mail Varchar(45)
Phno Varchar(45)
Address Varchar(45)
Altphno Varchar(45)
Landmark Varchar(45)
City Varchar(45)
Area Varchar(45)
Pincode int
Bus no int
Amount int

Bus

busno int
Travel bus type Varchar(45)
From1 Varchar(45)
To1 Varchar(45)
departure Varchar(45)
arrival Varchar(45)
duration Varchar(45)
ratings Varchar(45)

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 11

fare Varchar(45)
seats Varchar(45)

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 12

CODING

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 13

HOME.HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="javascript">
function myfun()
{
var M=document.HFORM.NAME
var N=document.HFORM.TO

if((M.value=="") || (M.value==null))
{
alert("Enter City In From Field (Source)");
M.focus()
return false
}
else
if((N.value=="") || (N.value==null))
{
alert("Enter City In To Field (Destination)");
N.focus()
return false
}
return true
}
</script>
<title>Insert title here</title>

</head>
<body bgcolor="white" scrolling="auto">
<form action="search.jsp" name="HFORM" onSubmit="return myfun()">
<table width="900" height="1" border="0" align="center">
<tr>
<th><a style=color:blue href="home.html">Home</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="print.html">Print Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="cancel.jsp">Cancel Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="aboutus.html">About Us</a></th>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<th>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 14

Need Help?Call <b style=color:blue>Bangalore</b> <select name="phno">


<option>8904296377</option>
<option>9535389398</option>
<option>8553432070</option>
</select>

</th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<table bgcolor="white" width="900" height="20" align="center" border="0">
<tr>
<th><img src="D:\bus\images\th.jpg" align="right"><img src="D:\bus\images\Blue-Bus-Logo
(264 x 89).jpg" align="left"></th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<table width="900" height="150" align="center" border="0">
<tr>
<th>
<h2 style=color:BLUE align="left">Book Bus Tickets with Zero Booking Fees</h2>

<table align="left" width="350" height="100" cellpadding="12" border="0">


<tr>
<td>FROM<br><input type="text" name="FROM" size="25"></td>
<td>TO<br><input type="text" name="TO" size="25"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input style=background:red style=color:white style=border-style:none type="submit"
name="SearchBuses" value="Search Buses" onfocus="myfun()" width="40">
</td>
</tr>
</table>
<table width="50" height="30" align="right" border="0">
<tr>
<th>
<img src="D:\bus\images\redbus_8year.png">
</th>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 15

</tr>
</table>

</th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<table width="900" height="250" align="center" border="0">
<tr>
<th>
<table>
<tr>
<th><img src="D:\bus\images\dussehra.png"></th>
<th><img src="D:\bus\images\rbapp100.png"></th>
<th><img src="D:\bus\images\roundtrip.png"></th>
<th><img src="D:\bus\images\9ipRr76iE (144 x 144).jpg"></th>
</tr>
</table>
</th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<table align="left" border="0" width="350" height="400">
<tr>
<th><h4 style=color:#FF0000>Top Bus Routes</h4></th>
</tr>
<tr>
<td>Bangalore-Karwar</td><td>Bangalore-Hubli</td>
</tr>
<tr>
<td>Bangalore-Goa</td><td>Goa-Bangalore</td>
</tr>
<tr>
<td>Delhi-Manali</td><td>Hyderabad-Banagalore</td>
</tr>
<tr>
<td>Pune-Bangalore</td><td>Delhi-Lucknow</td>
</tr>
<tr>
<td>Bhubaneshwar-Hyderabad</td><td>Pune-Hyderabad</td>
</tr>
<tr>
<td>Chennai-Bangalore</td><td>Bhubaneshwar-Kolkata</td>
</tr>
<tr>
<td>Lucknow-Delhi</td><td>Bangalore-Chennai</td>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 16

</tr>
<tr>
<td>Kolkata-Bhubaneshwar</td><td>Bangalore-Hyderabad</td>
</tr>
<tr>
<td>Manali-Delhi</td><td>Mumbai-Bangalore</td>
</tr>
</table>
<table align="right" border="0" width="350" height="400">
<tr>
<th><h4 style=color:#FF0000>Top Bus Routes</h4></th>
</tr>
<tr>
<td>Bangalore-Mumbai</td><td>Kerala-banagalore</td>
</tr>
<tr>
<td>Bangalore-Kerala</td><td>Karwar-banagalore</td>
</tr>
<tr>
<td>Bangalore-Belgaum</td><td>Hubli-bangalore</td>
</tr>
<tr>
<td>Belgaum-Bangalore</td><td>Bangalore-Mangalore</td>
</tr>
<tr>
<td>Mangalore-Bangalore</td><td>Bangalore-Mysore</td>
</tr>
<tr>
<td>Mysore-Bangalore</td><td>Bangalore-Udapi</td>
</tr>
<tr>
<td>Kolhapur-Bangalore</td><td>Bangalore-Ankola</td>
</tr>
<tr>
<td>Kolhapur-Belgaum</td><td>Belgaum-Goa</td>
</tr>
<tr>
<td>Kolhapur-Goa</td><td>Ankola-Bangalore</td>
</tr>
</table>
<table align="center" border="0" width="500" height="500">
<tr>
<th><h4 style=color:#FF0000>Top Bus Operators</h4></th>
</tr>
<tr>
<td>Vaibhav Travels(VOLVO A/C)</td><td>Naveen travels(VOLVO A/C)</td>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 17

</tr>
<tr>
<td>Ameer Travels</td><td>Parshawanath travel PVT LTD. ...</td>
</tr>
<tr>
<td>SVR Tours And Travels</td><td>SRS Travels</td>
</tr>
<tr>
<td>VRL Travels</td><td>Orange Tours And Travels</td>
</tr>
<tr>
<td>Sharma Transport</td><td>Royal Cruiser</td>
</tr>
<tr>
<td>Paulo Travels</td><td>Kallada Travels(VOLVO A/C)</td>
</tr>
<tr>
<td>Universal Travels</td><td>Sugama Travels</td>
</tr>
<tr>
<td>Sea Bird Travels</td><td>Neeta Travels</td>
</tr>
<tr>
<td>KSRTC Airavat(VOLVO A/C)</td><td>Rajesh Travels</td>
</tr>
<tr>
<td>Durgamba Travels</td><td>K.P.N</td>
</tr>
</table>
</form>
<hr style=color:#D3D3D3 size="2px">

<p align="center" class="copy">2014 &copy; BlueBus.com Designed By Vaibhav</p>


</body>
</html>

SEARCH.JSP

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 18

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body bgcolor="white">
<a style=color:blue href="home.html">Back</a>
<form action="booking.jsp">
<table width="900" height="1" border="0" align="center">
<tr>
<th><a style=color:blue href="home.html">Home</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="print.html">Print Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="cancel.html">Cancel Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="aboutus.html">About Us</a></th>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<th>
Need Help?Call <b style=color:blue>Bangalore</b> <select name="phno">
<option>8904296377</option>
<option>9535389398</option>
<option>8553432070</option>
</select>
</th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<table bgcolor="white" width="900" height="40" align="center" border="0">
<tr>
<th><img src="D:\bus\images\th.jpg" align="right"><img src="D:\bus\images\Blue-Bus-Logo
(264 x 89).jpg" align="left"></th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">

<%
String f=request.getParameter("FROM");
String t=request.getParameter("TO");

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 19

Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st=con.createStatement();
ResultSet rt=null;
rt=st.executeQuery("select * from bus where from1='"+f+"' and to1='"+t+"'");
%>

<table>
<tr>
<th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<h2
style=color:#4169E1><b>To Change The Route Go Back To Home</b></h2></th>
</tr>
</table>
<table border="1" align="center" BGCOLOR="white">
<tr>
<th>
<table align="center" width="1000" height="200" cellspacing="30"
BORDERCOLOR="#000000">
<tr><th><u> Bus No</u></th><th><u>Travel(Bus
Type)</u></th><th><u>From</u></th><th><u>To</u></th><th><u>Departure</u></th><th>
<u>Arrival</u></th><th><u>Duration</u></th><th><u>Ratings</u></th><th><u>Fare</u></t
h><th><u>Available Seats</u></th><th><u>Book</u></th></tr>

<%
while(rt.next())
{
%>
<tr><td><input readonly="readonly" border="0" size="1" color="#000000" type="text"
name="Busno" value="<%=rt.getString("busno")%>"></td>
<td><input readonly="readonly" border="0" size="25"color="#000000" type="text"
name="Travelbustype" value="<%=rt.getString("travelbustype")%>"></td>
<td><input readonly="readonly" border="0" size="8" color="#000000" type="text"
name="From" value="<%=rt.getString("from1")%>"></td>
<td><input readonly="readonly" border="0" size="8" color="#000000" type="text" name="To"
value="<%=rt.getString("to1")%>"></td>
<td><input readonly="readonly" border="0" size="6" color="#000000" type="text"
name="Departure" value="<%=rt.getString("departure")%>"></td>
<td><input readonly="readonly" border="0" size="6" color="#000000" type="text"
name="Arrival" value="<%=rt.getString("arrival")%>"></td>
<td><input readonly="readonly" border="0" size="7" color="#000000" type="text"
name="Duration" value="<%=rt.getString("duration")%>"></td>
<td><input readonly="readonly" border="0" size="1" color="#000000" type="text"
name="Ratings" value="<%=rt.getString("ratings")%>"></td>
<td><input readonly="readonly" border="0" size="2" color="#000000" type="text"
name="Fare" value="<%=rt.getString("fare")%>"></td>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 20

<td><input readonly="readonly" border="0" size="1" color="#000000" type="text"


name="Seats" value="<%=rt.getString("seats")%>"></td>

<td><input style=background:red style=color:white style=border-style:none type="submit"


name="Continue" value="Continue To Book"></td></tr>

<%
}
%>
</table>
</th>
</tr>
</table>
</body>
</html>

BOOKING.JSP
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="javascript">

function Validation()
{

var BP=document.frm.BP
var noseats=document.frm.noseats
var name1=document.frm.name1
var age=document.frm.age
var email=document.frm.email
var mobile=document.frm.mobile
var add=document.frm.address
var contact=document.frm.contact
var land=document.frm.landmark

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 21

var city=document.frm.city
var area=document.frm.area
var pin=document.frm.pincode
var dt=document.frm.date1;
if((dt.value=="") || (dt.value==null))
{
alert("Enter The Date Of Journey");
dt.focus()
return false
}
else
if((BP.value=="") || (BP.value==null))
{
alert("Select The Bording Point");
BP.focus()
return false
}
else
if((noseats.value=="") || (noseats.value==null))
{
alert("Select Number Of Seats");
noseats.focus()
return false
}
else
if((name1.value=="") || (name1.value==null))
{
alert("Enter Your Name");
name1.focus()
return false
}
else
if((age.value=="") || (age.value==null))
{
alert("Enter Your Age");
age.focus()
return false
}
else
if(isNaN(age.value))
{
alert("Text Not Allowed In Age Field");
age.focus();
return false;
}
else

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 22

if((email.value=="") || (email.value==null))
{
alert("Enter Your E-mail ID ");
email.focus()
return false
}
else
if((mobile.value=="") || (mobile.value==null))
{
alert("Enter Your Mobile Number");
mobile.focus()
return false
}
else
if(isNaN(mobile.value))
{
alert("Text Not Allowed In Mobile Number Field");
mobile.focus();
return false;
}
else
if(mobile.value.length<10||mobile.value.length>10)
{
alert("Enter Correct 10 Digit Phone Number In Mobile Number Field");
mobile.focus();
return false;
}
else
if((add.value=="") || (add.value==null))
{
alert("Enter Your Home Address");
add.focus()
return false
}
else
if((contact.value=="") || (contact.value==null))
{
alert("Enter Your Alternate Contact Number");
contact.focus()
return false
}
else
if(isNaN(contact.value))
{
alert("Text Not Allowed In Alternate Contact Number Field");
contact.focus();

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 23

return false;
}
else
if(contact.value.length<10||contact.value.length>10)
{
alert("Enter Correct 10 Digit Phone Number Alternate Contact Number Field");
contact.focus();
return false;
}
else
if((land.value=="") || (land.value==null))
{
alert("Enter Your Nearest Landmark ");
land.focus()
return false
}
else
if((city.value=="") || (city.value==null))
{
alert("Enter Your City");
city.focus()
return false
}
else
if((area.value=="") || (area.value==null))
{
alert("Enter Your Area Name");
area.focus()
return false
}
else
if((pin.value=="") || (pin.value==null))
{
alert("Enter Your Pincode");
pin.focus()
return false
}
else
if(isNaN(pin.value))
{
alert("Text Not Allowed In Pincode Field");
pin.focus();
return false;
}
else
if(pin.value.length<6||pin.value.length>6)

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 24

{
alert("Enter Correct 6 Digit Pincode Number");
pin.focus();
return false;
}
return true
}
</script>
<title>Insert title here</title>
</head>
<body>
<form action="last1.jsp" method=post name=frm onSubmit="return Validation()">
<a style=color:blue href="search.jsp">Back</a>
<table width="900" height="1" border="0" align="center">
<tr>
<th><a style=color:blue href="home.html">Home</a></th> &nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="print.jsp">Print Tickets</a></th> &nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="cancel.jsp">Cancel Tickets</a></th> &nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="aboutus.html">About Us</a></th> &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<th>
Need Help?Call <b style=color:blue>Bangalore</b> <select name="phno">
<option>8904296377</option>
<option>9535389398</option>
<option>8553432070</option>
</select>
</th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<table width="900" height="70" align="center" border="0">
<tr>
<th><img src="D:\bus\images\th.jpg" align="right"><img src="D:\bus\images\Blue-Bus-Logo
(264 x 89).jpg" align="left"></th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">

<table width="900" height="70" align="center" border="0">


<tr>
<td>
<h3>Booking Details</h3><hr style=color:#808080 size="5px">
</td>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 25

</tr>
<tr>
<td>Bus No</td>
<td>Available seats</td>
<td>Date</td>
<td>Boarding Point</td>
<td>No of Seats</td>
<td>Fare Per Seats</td>
</tr>
<tr>
<%
String available=request.getParameter("Seats");
String B=request.getParameter("Busno");
String F=request.getParameter("Fare");

%>
<td><input type="text" name="busno" value="<%=B %>" readonly="readonly"></td>
<td><input type="text" name="seats" value="<%=available %>" readonly="readonly"></td>
<td><input type="date" name="date1"></td>
<td><select name="BP">
<option></option>
<option value=Majestic>Majestic</option>
<option value=Jayanagar>Jayanagar 4th block</option>
<option value=Shantinagar>Shantinagar</option>
<option value=Brigade>J.P nagar(Brigade Millenium)</option>
<option value=BTM>B.T.M Layout</option>
</select>
</td>
<td><select name="noseats">
<option></option>
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
</select></td>
<td><input type="text" name="fare1" value="<%=F %>" readonly="readonly"></td>
</tr>
<tr>

<td><h3>Passenger Details</h3><hr style=color:#808080 size="5px"></td>


</tr>
<tr>
<td>Name</td>
<td>Gender</td>
<td>Age</td>
</tr>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 26

<tr>
<td><input type="text" name="name1"></td>
<td><input type="radio" name="gender" value="M" checked="checked"> M <input
type="radio" name="gender" value="F"> F</td>
<td>
<input type="text" name="age"></td>
</tr>
<tr>

<td><h3>Contact Details</h3><hr style=color:#808080 size="5px"></td>


</tr>
<tr>
<td>E-mail <input type="text" name="email"></td>
<td>Mobile <input type="text" name="mobile" value"+91"></td>
<tr>

<td><h3>Cash on Delivery</h3><hr style=color:#808080 size="5px"></td>


</tr>

</table>
<table width="500" height="300" align="center" border="1">
<tr>
<th>
<table width="500" height="300" align="center" border="0">
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Home Address
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="address"></td>
</tr>
<tr>
<td>Alternate Contact No&nbsp;&nbsp;&nbsp;<input type="text" name="contact"></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Landmark&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="landmark"></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;City&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="city"></td>
</tr>
<tr>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 27

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Area&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
<input type="text" name="area"></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pincode&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="pincode"></td>
</tr>
<tr>
<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input style=background:red style=color:white style=border-style:none type="submit"
name="Book" value="Confirm" onfocus="Validation()">
</td>
</tr>
</table>
</th>
</tr>
</table>
</body>
</html>

CONFIRM.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 28

<title>Insert title here</title>


</head>
<body bgcolor=#EEE8AA>
<form action="last.jsp" method=post>
<%
String n1=request.getParameter("date1");
String n2=request.getParameter("BP");
String n4=request.getParameter("name1");
String n5=request.getParameter("gender");
String n6=request.getParameter("age");
String n7=request.getParameter("email");
String n8=request.getParameter("mobile");
String n9=request.getParameter("address");
String n10=request.getParameter("contact");
String n11=request.getParameter("landmark");
String n12=request.getParameter("city");
String n13=request.getParameter("area");
String n14=request.getParameter("pincode");

try
{
String NS=request.getParameter("noseats");
String BS1=request.getParameter("busno");
int BS2=Integer.parseInt(BS1);
String AS=request.getParameter("seats");
int AS1=Integer.parseInt(AS);
int NS1=Integer.parseInt(NS);
int X=AS1-NS1;
String F1=request.getParameter("fare1");
int F2=Integer.parseInt(F1);
int F3=NS1*F2;

Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st1=con.createStatement();

int rt=st1.executeUpdate("insert into bookdetails


(Date,Arrivalplace,Noseats,Name,Gender,Age,Email,Phno,Address,AltPhno,Landmark,City,Are
a,Pincode,busno,fare)
values('"+n1+"','"+n2+"','"+NS+"','"+n4+"','"+n5+"','"+n6+"','"+n7+"','"+n8+"','"+n9+"','"+n10+"'
,'"+n11+"','"+n12+"','"+n13+"','"+n14+"','"+BS2+"','"+F3+"')");

int rt2=st1.executeUpdate("update bus set seats='"+X+"' where busno='"+BS2+"'");


%>
<table align="center" height="500" width="500" cellspacing="20" background="yellow">

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 29

<tr>
<th>Bus Number</th>
<td><input type="text" name="bsno" value="<%=BS1%>" readonly="readonly"></td>
<th>Passanger Name</th>
<td><input type="text" name="pname" value="<%=n4%>" readonly="readonly"></td>
</tr>
<tr>
<th>E-mail ID</th>
<td><input type="text" name="eml" value="<%=n7%>" readonly="readonly">
<th>Phone Number</th>
<td><input type="text" name="cnt" value="<%=n8%>" readonly="readonly"></td>
</tr>
<tr>
<th>Number Of Seats</th>
<td><input type="text" name="nos" value="<%=NS%>" readonly="readonly"></td>
<th>Fare Per Seat</th>
<td><input type="text" name="fre" value="<%=F1%>" readonly="readonly"></td>
</tr>
<tr>
<th>Amount Payable</th>
<td><input type="text" name="tf" value="<%=F3%>" readonly="readonly"></td>
</tr>
<tr>
<th><input type="submit" name="SUB" value="Proceed To Print"></th>
</tr>
</table>
<%
}
catch(Exception e)
{
out.println("heloo");
}
%>
</form>
</body>
</html>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 30

LAST.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="javax.xml.bind.ParseConversionEvent"%>
<%@page import="com.sun.corba.se.spi.ior.Writeable"%>
<%@page import="com.sun.corba.se.spi.ior.WriteContents"%>
<%@page import="javax.xml.bind.helpers.ParseConversionEventImpl"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
function C()
{
window.print();
}
</script>
</head>
<body>
<form name=frm>
<table width="900" height="1" border="0" align="center">
<tr>
<th><a style=color:blue href="home.html">Home</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="print.html">Print Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="cancel.html">Cancel Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="aboutus.html">About Us</a></th>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<th>
Need Help?Call <b style=color:blue>Bangalore</b> <select name="phno">
<option>8904296377</option>
<option>9535389398</option>
<option>8553432070</option>
</select>
</th>
</tr>
</table>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 31

<hr style=color:#D3D3D3 size="2px">


<table bgcolor="white" width="900" height="40" align="center" border="0">
<tr>
<th><img src="D:\bus\images\th.jpg" align="right"><img src="D:\bus\images\Blue-Bus-Logo
(264 x 89).jpg" align="left"></th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">

<%
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st2=con.createStatement();
Statement st3=con.createStatement();
String BS=request.getParameter("bsno");
String Em=request.getParameter("eml");
ResultSet rt1=st2.executeQuery(("select * from bus b, bookdetails c where c.busno=b.busno and
b.busno='"+BS+"' and c.Email='"+Em+"'"));
while(rt1.next())
{
%>
<table>
<tr>
<th><h2 style=color:#4169E1><b>Your Ticket Booking Details Are</b></h2></th>
</tr>
</table>
<table align="center" width="1000" height="200" cellspacing="4"
BORDERCOLOR="#000000">
<tr>
<th>Bus Number</th>
<th><input style=border:hidden type="text" name="BSN"
value="<%=rt1.getString("busno")%>" readonly="readonly"></th>&nbsp;&nbsp;&nbsp;
<th>Ticket Number</th>
<th><input style=border:hidden type="text" name="TKN"
value="<%=rt1.getString("Ticketno")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Travel(Bus Type)</th>
<th><input style=border:hidden type="text" name="TR"
value="<%=rt1.getString("travelbustype")%>"
readonly="readonly"></th>&nbsp;&nbsp;&nbsp;
<th>Date</th>
<th><input style=border:hidden type="text" name="DT" value="<%=rt1.getString("Date")%>"
readonly="readonly"></th>
</tr>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 32

<tr>
<th>From</th>
<th><input style=border:hidden type="text" name="FR" value="<%=rt1.getString("from1")%>"
readonly="readonly"></th>
<th>To</th>
<th><input style=border:hidden type="text" name="T" value="<%=rt1.getString("to1")%>"
readonly="readonly">&nbsp;&nbsp;&nbsp;</th>
<th>Arrival Place</th>
<th><input style=border:hidden type="text" name="AR"
value="<%=rt1.getString("Arrivalplace")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Departure</th>
<th><input style=border:hidden type="text" name="DP"
value="<%=rt1.getString("departure")%>" readonly="readonly"></th>
&nbsp;&nbsp;&nbsp;<th>No Of Seats</th><th><input style=border:hidden type="text"
name="NSS" value="<%=rt1.getString("Noseats") %>" readonly="readonly"></th>
</tr>
<tr>
<th>Arrival</th>
<th><input style=border:hidden type="text" name="AR1"
value="<%=rt1.getString("arrival")%>" readonly="readonly"></th>
&nbsp;&nbsp;&nbsp;<th>Name</th><th><input style=border:hidden type="text" name="NM"
value="<%=rt1.getString("Name")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Duration</th>
<th><input style=border:hidden type="text" name="DR"
value="<%=rt1.getString("duration")%>" readonly="readonly"></th>
&nbsp;&nbsp;&nbsp;<th>Gender</th><th><input style=border:hidden type="text" name="GN"
value="<%=rt1.getString("Gender")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Fare/seat</th>
<th><input style=border:hidden type="text" name="FR" value="<%=rt1.getString("fare")%>"
readonly="readonly"></th>&nbsp;&nbsp;&nbsp;
<th>Age</th>
<th><input style=border:hidden type="text" name="AG" value="<%=rt1.getString("Age")%>"
readonly="readonly"></th>
</tr>
<tr>
<th>E-Mail ID</th>
<th><input style=border:hidden type="text" name="EM"
value="<%=rt1.getString("Email")%>" readonly="readonly"></th>&nbsp;&nbsp;&nbsp;
<th>Phone Number</th>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 33

<th><input style=border:hidden type="text" name="PH" value="<%=rt1.getString("Phno")%>"


readonly="readonly"></th>
</tr>
<tr>
<th>Pincode</th>
<th><input style=border:hidden type="text" name="PN"
value="<%=rt1.getString("Pincode")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Amount Payable</th><th><input style=border:hidden type="text" name="AM"
value="<%=rt1.getString("Fare")%>" readonly="readonly"></th>
</tr>
</table>
</form>

<%
}
%>
<form action="home.html">
<table align="right" width="400" height="5">
<tr>
<th>
<input type="submit" name="finish" value="Finish">
</th>
</tr>
</table>
</form>

</body>
</html>

PRINT.HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"


"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script languagee="javascript">
function val()
{
var ptext=document.f1.ptext
var pbusno=document.f1.pbusno

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 34

var Nme=document.f1.Nme
var Eid=document.f1.Eid
var Phn=document.f1.Phn

if((ptext.value=="") || (ptext.value==null))
{
alert("Enter Your Ticket Number");
ptext.focus()
return false
}
else
if((pbusno.value=="") || (pbusno.value==null))
{
alert("Enter Bus Number");
pbusno.focus()
return false
}
else
if((Nme.value=="") || (Nme.value==null))
{
alert("Enter Your Name");
Nme.focus()
return false
}
else
if((Eid.value=="") || (Eid.value==null))
{
alert("Enter Your E-mail ID ");
Eid.focus()
return false
}
else
if((Phn.value=="") || (Phn.value==null))
{
alert("Enter Your Contact Number");
Phn.focus()
return false
}
return true
}
</script>
<title>Insert title here</title>
</head>
<body bgcolor="white">
<form action="retrievenprint.jsp" name="f1" onSubmit="return val()" method="post">
<a style=color:blue href="home.html">Back</a>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 35

<table width="900" height="1" border="0" align="center">


<tr>
<th><a style=color:blue href="home.html">Home</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="print.html">Print Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="cancel.jsp">Cancel Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="aboutus.html">About Us</a></th>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<th>
Need Help?Call <b style=color:blue>Bangalore</b> <select name="phno">
<option>8904296377</option>
<option>9535389398</option>
<option>8553432070</option>
</select>

</th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<table bgcolor="white" width="900" height="40" align="center" border="0">
<tr>
<th><img src="D:\bus\images\th.jpg" align="right"><img src="D:\bus\images\Blue-Bus-Logo
(264 x 89).jpg" align="left"></th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<h1 style=color:blue align="center">Print Ticket</h1>
<table width="500" height="200" align="center" border="0" cellspacing="20">
<tr>
<th>Ticket Number </th><th><input type="text" name="ptext"></th><th>Bus
Number</th><th><input type="text" name="bsno"></th>
</tr>
<tr>
<th>Your Name</th><th><input type="text" name="Nme"></th><th>E-mail
ID</th><th><input type="text" name="eml"></th>
</tr>
<tr>
<th>Phone Number</th><th><input type="text" name="Phn"></th>
</tr>
<tr>
<th><input style="background:red;color:white;border-style:none;" type="submit"
name="psubmit" value="Submit" onfocus="val()"></th>
</tr>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 36

</table>
</form>
<hr style=color:#D3D3D3 size="2px">
<p align="center" class="copy">2014 &copy; BlueBus.com Designed By Vaibhav</p>
</body>
</html>

RETRIEVENPRINT.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
function C()
{
window.print();
}
</script>
</head>
<body>
<form name=frm10>
<table bgcolor="white" width="900" height="40" align="center" border="0">
<tr>
<th><img src="D:\bus\images\th.jpg" align="right"><img src="D:\bus\images\Blue-Bus-Logo
(264 x 89).jpg" align="left"></th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">

<%
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st2=con.createStatement();
Statement st3=con.createStatement();
String BS=request.getParameter("bsno");
String Em=request.getParameter("eml");

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 37

ResultSet rt1=st2.executeQuery(("select * from bus b, bookdetails c where c.busno=b.busno and


b.busno='"+BS+"' and c.Email='"+Em+"'"));
while(rt1.next())
{
%>
<table>
<tr>
<th><h2 style=color:#4169E1 align="center"><b>Your Ticket Booking Details
Are</b></h2></th>
</tr>
</table>
<table align="center" width="1000" height="200" cellspacing="4"
BORDERCOLOR="#000000">
<tr>
<th>Bus Number</th>
<th><input style=border:hidden type="text" name="BSN"
value="<%=rt1.getString("busno")%>" readonly="readonly"></th>&nbsp;&nbsp;&nbsp;
<th>Ticket Number</th>
<th><input style=border:hidden type="text" name="TKN"
value="<%=rt1.getString("Ticketno")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Travel(Bus Type)</th>
<th><input style=border:hidden type="text" name="TR"
value="<%=rt1.getString("travelbustype")%>"
readonly="readonly"></th>&nbsp;&nbsp;&nbsp;
<th>Date</th>
<th><input style=border:hidden type="text" name="DT" value="<%=rt1.getString("Date")%>"
readonly="readonly"></th>
</tr>
<tr>
<th>From</th>
<th><input style=border:hidden type="text" name="FR" value="<%=rt1.getString("from1")%>"
readonly="readonly"></th>
<th>To</th>
<th><input style=border:hidden type="text" name="T" value="<%=rt1.getString("to1")%>"
readonly="readonly">&nbsp;&nbsp;&nbsp;</th>
<th>Arrival Place</th>
<th><input style=border:hidden type="text" name="AR"
value="<%=rt1.getString("Arrivalplace")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Departure</th>
<th><input style=border:hidden type="text" name="DP"
value="<%=rt1.getString("departure")%>" readonly="readonly"></th>
&nbsp;&nbsp;&nbsp;

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 38

<th>No Of Seats</th>
<th><input style=border:hidden type="text" name="NSS" value="<%=rt1.getString("Noseats")
%>" readonly="readonly"></th>
</tr>
<tr>
<th>Arrival</th>
<th><input style=border:hidden type="text" name="AR1"
value="<%=rt1.getString("arrival")%>" readonly="readonly"></th>
&nbsp;&nbsp;&nbsp;
<th>Name</th><th><input style=border:hidden type="text" name="NM"
value="<%=rt1.getString("Name")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Duration</th>
<th><input style=border:hidden type="text" name="DR"
value="<%=rt1.getString("duration")%>" readonly="readonly"></th>
&nbsp;&nbsp;&nbsp;
<th>Gender</th><th><input style=border:hidden type="text" name="GN"
value="<%=rt1.getString("Gender")%>" readonly="readonly"></th>
</tr>
<tr>
<th>Fare/seat</th>
<th><input style=border:hidden type="text" name="FR" value="<%=rt1.getString("fare")%>"
readonly="readonly"></th>&nbsp;&nbsp;&nbsp;
<th>Age</th>
<th><input style=border:hidden type="text" name="AG" value="<%=rt1.getString("Age")%>"
readonly="readonly"></th>
</tr>
<tr>
<th>E-Mail ID</th>
<th><input style=border:hidden type="text" name="EM"
value="<%=rt1.getString("Email")%>" readonly="readonly"></th>&nbsp;&nbsp;&nbsp;
<th>Phone Number</th>
<th><input style=border:hidden type="text" name="PH" value="<%=rt1.getString("Phno")%>"
readonly="readonly"></th>
</tr>
<tr>
<th>Pincode</th>
<th><input style=border:hidden type="text" name="PN"
value="<%=rt1.getString("Pincode")%>" readonly="readonly"></th>
</tr>

<tr>
<th>Amount Payable</th>
<th><input style=border:hidden type="text" name="AM" value="<%=rt1.getString("Fare")%>"
readonly="readonly"></th>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 39

</tr>
</table>
<%
}
%>
</form>
<table align="right" width="400" height="1" border="0">
<tr>
<th>
<input type=button onclick="C()" value="print" align="center">
</th>
</tr>
</table>
</body>
</html>

CANCEL.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script languagee="javascript">
function vali()
{
var ctext1=document.f2.ctext1
var ctext2=document.f2.ctext2
var ctext3=document.f2.ctext3
var ctext4=document.f2.ctext4
var ctext5=document.f2.ctext5

if((ctext1.value=="") || (ctext1.value==null))
{
alert("Enter Your Ticket Number");
ctext1.focus()
return false
}
else
if((ctext2.value=="") || (ctext2.value==null))
{
alert("Enter Bus Number");

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 40

ctext2.focus()
return false
}
else
if((ctext3.value=="") || (ctext3.value==null))
{
alert("Enter Your Name");
ctext3.focus()
return false
}
else
if((ctext4.value=="") || (ctext4.value==null))
{
alert("Enter Your E-mail ID ");
ctext4.focus()
return false
}
else
if((ctext5.value=="") || (ctext5.value==null))
{
alert("Enetr Your Contact Number");
ctext5.focus()
return false
}
return true
}
</script>
<title>Insert title here</title>
</head>
<body bgcolor="white">
<form action="complete.jsp" name="f2" onSubmit="return vali()">
<a style=color:blue href="home.html">Back</a>
<table width="900" height="1" border="0" align="center">
<tr>
<th><a style=color:blue href="home.html">Home</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="print.html">Print Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="cancel.jsp">Cancel Tickets</a></th>&nbsp;&nbsp;&nbsp;
<th><a style=color:blue href="aboutus.html">About Us</a></th>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<th>
Need Help?Call <b style=color:blue>Bangalore</b> <select name="phno">
<option>8904296377</option>
<option>9535389398</option>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 41

<option>8553432070</option>
</select>

</th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<table bgcolor="white" width="900" height="40" align="center" border="0">
<tr>
<th><img src="D:\bus\images\th.jpg" align="right"><img src="D:\bus\images\Blue-Bus-Logo
(264 x 89).jpg" align="left"></th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">
<h1 style=color:blue align="center">Cancel Ticket</h1>
<table width="350" height="200" align="center" border="0" cellspacing="20">
<tr>
<th>Ticket Number</th><th><input type="text" name="ctext1"></th><th>Bus
Number</th><th><input type="text" name="ctext2"></th>
</tr>
<tr>
<th>Your Name</th><th><input type="text" name="ctext3"></th><th>E-mail</th><th><input
type="text" name="ctext4"></th>
</tr>
<tr>
<th>Phone Number</th><th><input type="text" name="ctext5"></th>
</tr>
<tr>
<th><input style=background:red style=color:white style=border-style:none type="submit"
name="Csubmit" value="Submit" onfocus="vali()"></th>
</tr>

</table>
</body></html>
COMPLETE.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 42

</head>
<body>
<form action="cancel1.jsp" name="can">
<%
String TN=request.getParameter("ctext1");
String BN=request.getParameter("ctext2");
String NN=request.getParameter("ctext3");
String EM=request.getParameter("ctext4");
String PH=request.getParameter("ctext5");

Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st5=con.createStatement();
ResultSet rs5=st5.executeQuery("select * from bookdetails where Ticketno='"+TN+"' and
busno='"+BN+"'");
while(rs5.next())
{%>
<table width="350" height="200" align="center" border="0" cellspacing="20">
<tr>
<th>Ticket Number</th><th><input type="text" name="c1" value="<%=TN%>"></th><th>Bus
Number</th><th><input type="text" name="c2" value="<%=BN%>"></th>
</tr>
<tr>
<th>Your Name</th><th><input type="text" name="c3" value="<%=NN%>"></th><th>E-
mail</th><th><input type="text" name="c4" value="<%=EM%>"></th>
</tr>
<tr>
<th>Phone Number</th><th><input type="text" name="c5" value="<%=PH%>"></th>
<th>No Of Seats</th><th><input type="text" name="c6"
value="<%=rs5.getString("Noseats")%>"></th>
</tr>
<tr>
<th>Arrival Place</th><th><input type="text" name="c7"
value="<%=rs5.getString("Arrivalplace")%>"></th>
<th>Date</th><th><input type="text" name="c8" value="<%=rs5.getString("Date")%>"></th>
</tr>
<tr>
<th>Age</th><th><input type="text" name="c9" value="<%=rs5.getString("Age")%>"></th>
<th>Gender</th><th><input type="text" name="c10"
value="<%=rs5.getString("Gender")%>"></th>
</tr>
<tr>
<th>Address</th><th><input type="text" name="c11"
value="<%=rs5.getString("Address")%>"></th>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 43

<th>Total Amount</th><th><input type="text" name="c12"


value="<%=rs5.getString("Fare")%>"></th>
</tr>
<tr>
<th><input type="submit" name="cancel" value="Confirm And Proceed"></th>
</tr>
</table>

<%
}
%>
</form>
</body>
</html>

CANCEL1.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String TN1=request.getParameter("c1");
String BN5=request.getParameter("c2");
String NO=request.getParameter("c6");
String EM1=request.getParameter("c4");
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st6=con.createStatement();
Statement st7=con.createStatement();

int rt2=st6.executeUpdate("update bus set seats=seats+'"+NO+"' where busno='"+BN5+"'");

int rt3=st7.executeUpdate("delete from bookdetails where Ticketno='"+TN1+"' and


Email='"+EM1+"'");

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 44

%>
<h1><% out.println("Your Ticket Is Cancelled Successfully");%></h1>
</body>
</html>

ADMIN.HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"


"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="javascript">
function myfunc1()
{
var x1=document.f3.uname;
var y1=document.f3.pwd;
if(x1.value==""||x1.value==null)
{
alert("Enter Username")
x1.focus();
return false;
}

if(y1.value==""||y1.value==null)
{
alert("Enter Password")
y1.focus();
return false;
}
if(y1.value.length<7)
{
alert("password should be atleast 7 characters")
y1.focus();
return false;
}
return true;
}
</script>
<title>ADMIN PAGE</title>
</head>
<body bgcolor="white">
<img src="D:\bus\images\Blue-Bus-Logo (264 x 89).jpg" align="left"><img
src="D:\bus\images\administrator.jpg" align="left"><br><br>
<h2 align=center style=color:grey>LOGIN</h2><br><br>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 45

<form name=f3 action="inner.jsp">


<table border=0 align=center>
<tr>
<td style=color:blue>USER NAME</td>
</tr>
<tr>
<td><input id="txtId" type="text" name="uname"></td>
</tr>
<tr>
<td style=color:blue>PASSWORD</td>
</tr>
<tr>
<td><input id="txtPsw" type="password" name="pwd"></td>
</tr>
<tr>
<th colspan=2 align=center><input type="submit" name="sign" style=color:blue onclick="return
myfunc1()" value="LOGIN"></th>
</tr>
</table>
</form>
<br>
<br><br>
<br><br>
<br>
<br><br>
<br>
<br>
<br><br>
<br>
</body>
</html>

INNER.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 46

<title>Insert title here</title>


</head>
<body>
<a style=color:blue href="admin.html">Back</a>
<table bgcolor="white" width="500" height="16" align="left" border="0">
<tr>
<th><img src="D:\bus\images\administrator.jpg" align="left"></th>
</tr>
</table>
<h1 align="justify" style=color:red>Error Notification</h1>
<table bgcolor="white" width="500" height="20" align="left" border="0">
<tr>
<th><img src="D:\bus\images\Blue-Bus-Logo (264 x 89).jpg" align="center">
</th>
</tr>
</table>

<%
String name=request.getParameter("uname");
String name1=request.getParameter("pwd");
String qry;
qry="select uname,pwd from admin";
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery(qry);

int x=0;
while(rs.next())
{
String un=rs.getString(1);
String pd=rs.getString(2);
if(un.equalsIgnoreCase(name)&&pd.equalsIgnoreCase(name1))
{
%>
<jsp:forward page="update.jsp"></jsp:forward>
x=1;
<%

}
if(x==0)
{
%>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 47

<h3 style=color:red align="center"><big>Your Not Authenticated For This Service.</big></h3>


<%
}
%>
</body>
</html>

UPDATE.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>Insert title here</title>


</head>
<body>
<h4 align="right"><a style=color:blue href="admin.html">Log Out</a></h4>

<table bgcolor="white" width="500" height="15" align="left" border="0">


<tr>
<th><img src="D:\bus\images\Blue-Bus-Logo (264 x 89).jpg" align="left"><img
src="D:\bus\images\administrator.jpg" align="left"></th>
</tr>
</table>
<br><br><br>
<form action="new.jsp">
<table bgcolor="white" width="500" height="20" align="right" border="0">
<tr>
<th>Update For New Travels &nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="new"
value="ADD NEW TRAVELS"></th>
</tr>
</table>
</form>
<br><br><br><br><br><br>
<form action="bframe.html">
<table bgcolor="white" width="500" height="20" border="0">
<tr>
<th>&nbsp;&nbsp;&nbsp;&nbsp;
Update For Existing Travels &nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="new"
value="EDIT EXISTING TRAVELS"></th>
</tr>
</table>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 48

</form>
</body>
</html>

NEW.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="javascript">
function valid()
{
var B1=document.frm1.Nbusno
var T1=document.frm1.Ntravelbustype
var F1=document.frm1.Nfrom
var T11=document.frm1.Nto
var D1=document.frm1.Ndept
var A1=document.frm1.Narr
var D11=document.frm1.Ndur
var R1=document.frm1.Nrate
var F11=document.frm1.Nfare
var S1=document.frm1.Nseats

if((B1.value=="") || (B1.value==null))
{
alert("Enter The Busno");
B1.focus()
return false
}
else
if((T1.value=="") || (T1.value==null))
{
alert("Enter Travels Name");
T1.focus()
return false
}
else
if((F1.value=="") || (F1.value==null))

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 49

{
alert("Enter From Place (Source)");
F1.focus()
return false
}
else
if((T11.value=="") || (T11.value==null))
{
alert("Enter To Place (Destination)");
T11.focus()
return false
}
else
if((D1.value=="") || (D1.value==null))
{
alert("Enter The Departure Time");
return false
}
else
if((A1.value=="") || (A1.value==null))
{
alert("Enter The Arrival Time");
A1.focus()
return false
}
else
if((D11.value=="") || (D11.value==null))
{
alert("Enter The Duration Of Journey");
D11.focus()
return false
}
else
if((R1.value=="") || (R1.value==null))
{
alert("Enter The Ratings");
R1.focus()
return false
}
else
if((F11.value=="") || (F11.value==null))
{
alert("Enter Fare Per Seat");
F11.focus()
return false
}

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 50

else
if(isNaN(F11.value))
{
alert("Text Not Allowed In Fare Field");
F11.focus();
return false;
}
else
if((S1.value=="") || (S1.value==null))
{
alert("Enter Number Of Seats");
S1.focus()
return false
}
else
if(isNaN(S1.value))
{
alert("Text Not Allowed In Seats Field");
S1.focus();
return false;
}
return true
}
</script>
<title>Insert title here</title>
</head>
<body>
<a style=color:blue href="update.jsp">Back</a>
<table bgcolor="white" width="500" height="20" align="left" border="0">
<tr>
<th><img src="D:\bus\images\administrator.jpg" align="left"></th>
</tr>
</table>
<h1>Insert The Information To Be Applied For New Travels</h1>
<form action="new.jsp" name="frm1" onsubmit="return valid()">
<table width="400" height="70" align="center" border="0">
<tr>
<th>Bus no</th><th><input type="text" name="Nbusno"></th>
</tr>
<tr>
<th>Travel(Bus type)</th><th><input type="text" name="Ntravelbustype"></th>
</tr>
<tr>
<th>From</th><th><input type="text" name="Nfrom"></th>
</tr>
<tr>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 51

<th>To</th><th><input type="text" name="Nto"></th>


</tr>
<tr>
<th>Departure</th><th><input type="text" name="Ndept"></th>
</tr>
<tr>
<th>Arrival</th><th><input type="text" name="Narr"></th>
</tr>
<tr>
<th>Duration</th><th><input type="text" name="Ndur"></th>
</tr>
<tr>
<th>Ratings</th><th><input type="text" name="Nrate"></th>
</tr>
<tr>
<th>Fare</th><th><input type="text" name="Nfare"></th>
</tr>
<tr>
<th>Seats Containing</th><th><input type="text" name="Nseats"></th>
</tr>
</table>
<table align="center">
<tr>
<th>
<input type="submit" onfocus="valid()" name="Newupdate" value="Proceed">
</th>
</tr>
</table>
</form>

<form action="message.jsp" name="frm11">


<table align="center">
<tr>
<th>
<input type="submit" name="confirm" value="confirm">
</th>
</tr>
</table>
<br>
<br><br>
<br><br>
<p align="left" class="copy">2014 &copy; BlueBus.com Designed By Vaibhav</p>
<%
try
{
String NB=request.getParameter("Nbusno");

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 52

int NB1=Integer.parseInt(NB);
String NTBT=request.getParameter("Ntravelbustype");
String NF=request.getParameter("Nfrom");
String NT=request.getParameter("Nto");
String ND=request.getParameter("Ndept");
String NA=request.getParameter("Narr");
String NDR=request.getParameter("Ndur");
String NR=request.getParameter("Nrate");
String NFR=request.getParameter("Nfare");
String NS=request.getParameter("Nseats");

Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st1=con.createStatement();
int rs=st1.executeUpdate("insert into bus
(busno,travelbustype,from1,to1,departure,arrival,duration,ratings,fare,seats)
values('"+NB1+"','"+NTBT+"','"+NF+"','"+NT+"','"+ND+"','"+NA+"','"+NDR+"','"+NR+"','"+N
FR+"','"+NS+"')");
out.println("Inserted");
}
catch(Exception e)
{
out.println("");
}

%>

</body>
</html>

EDIT.JSP

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="javascript">
function validate()
{

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 53

var B2=document.frm2.Ebusno

if((B2.value=="") || (B2.value==null))
{
alert("Enter The Busno");
B2.focus()
return false
}
return true
}
</script>
<title>Insert title here</title>
</head>
<body>
<form action="edit.jsp" name="frm2" onsubmit="return validate()">
<a style=color:blue href="update.jsp">Back</a>
<table bgcolor="white" width="500" height="20" align="left" border="0">
<tr>
<th><img src="D:\bus\images\administrator.jpg" align="left"></th>
</tr>
</table>
<h1>Insert The Information To Be Updated For Existing Travels</h1>
<table width="400" height="70" align="center" border="0">
<tr>
<th>Bus no</th><th><input type="text" name="Ebusno"></th>
<th><input type="Submit" name="Editsearch" value="search" align="middle"
onfocus="validate()"></th>
</tr>

</table>

<%ss
String BS=request.getParameter("Ebusno");
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st1=con.createStatement();
ResultSet rs=st1.executeQuery("select * from bus where busno='"+BS+"'");
if(rs.next())
{
%>
<table>
<tr>
<th>Bus no</th><th><input type="text" name="Ebusno" value="<%=rs.getString("busno")%>"
readonly="readonly"></th>
</tr>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 54

<tr>
<th>Travel(Bus type)</th><th><input type="text" name="Etravelbustype"
value="<%=rs.getString("travelbustype")%>"></th>
</tr>
<tr>
<th>From</th><th><input type="text" name="Efrom"
value="<%=rs.getString("from1")%>"></th>
</tr>
<tr>
<th>To</th><th><input type="text" name="Eto" value="<%=rs.getString("to1")%>"></th>
</tr>
<tr>
<th>Departure</th><th><input type="text" name="Edept"
value="<%=rs.getString("departure")%>"></th>
</tr>
<tr>
<th>Arrival</th><th><input type="text" name="Earr"
value="<%=rs.getString("arrival")%>"></th>
</tr>
<tr>
<th>Duration</th><th><input type="text" name="Edur"
value="<%=rs.getString("duration")%>"></th>
</tr>
<tr>
<th>Ratings</th><th><input type="text" name="Erate"
value="<%=rs.getString("ratings")%>"></th>
</tr>
<tr>
<th>Fare</th><th><input type="text" name="Efare" value="<%=rs.getString("fare")%>"></th>
</tr>
<tr>
<th>Seats Containing</th><th><input type="text" name="Eseats"
value="<%=rs.getString("seats")%>"></th>
</tr>
</table>
<%
}
%>
</form>
<table>
<tr>
<td><input type="Submit" name="EditUpdate" value="Proceed" align="right"></td>
</tr>
</table>

<%

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 55

try
{
String EB=request.getParameter("Ebusno");
int EB1=Integer.parseInt(EB);
String ETBT=request.getParameter("Etravelbustype");
String EF=request.getParameter("Efrom");
String ET=request.getParameter("Eto");
String ED=request.getParameter("Edept");
String EA=request.getParameter("Earr");
String EDR=request.getParameter("Edur");
String ER=request.getParameter("Erate");
String EFR=request.getParameter("Efare");
String ES=request.getParameter("Eseats");

System.out.println("from "+ EF);

Class.forName("com.mysql.jdbc.Driver");
Connection
con1=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st2=con.createStatement();
int rt=st2.executeUpdate("update bus set
travelbustype='"+ETBT+"',from1='"+EF+"',to1='"+ET+"',departure='"+ED+"',arrival='"+EA+"',
duration='"+EDR+"',ratings='"+ER+"',fare='"+EFR+"',seats='"+ES+"' where
busno='"+EB1+"'");
}
catch(Exception e)
{
out.println(e);
}
%>
</body>
</html>

MESSAGE.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<a style=color:blue href="update.jsp">Back</a>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 56

<h1 align="center"><% out.println("Update Has Been Successful"); %></h1>

</body>
</html>

CHECKING.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<a style=color:blue href="update.jsp">Back</a>
<table bgcolor="white" width="900" height="40" align="center" border="0">
<tr>
<th><img src="images\th.jpg" align="right"><img src="images\Blue-Bus-Logo (264 x 89).jpg"
align="left"></th>
</tr>
</table>
<hr style=color:#D3D3D3 size="2px">

<%
String f=request.getParameter("FROM");
String t=request.getParameter("TO");
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
Statement st=con.createStatement();
ResultSet rtt=null;
rtt=st.executeQuery("select * from bookdetails");
%>

<table>
<tr>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 57

<th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<h2
style=color:#4169E1><b>Customer Booking Deatils</b></h2></th>
</tr>
</table>
<table border="1" align="center" BGCOLOR="white">
<tr>
<th>
<table align="center" width="900" height="200" cellspacing="30"
BORDERCOLOR="#000000">
<tr><th><u>Ticket Number</u></th><th><u>Date</u></th><th><u>Arrival
Place</u></th><th><u>No Of
Seats</u></th><th><u>Name</u></th><th><u>Gender</u></th>
<th><u>Age</u></th><th><u>Email-ID</u></th><th><u>Phone
Number</u></th><th><u>Address</u></th><th><u>Alternate
Contact</u></th><th><u>Landmark</u></th>
<th><u>City</u></th><th><u>Area</u></th><th><u>Pincode</u></th><th><u>Bus
Number</u></th><th><u>Amount Payable</u></th></tr>

<%
while(rtt.next())
{
%>
<tr><td><input readonly="readonly" style=border:"0" size="1" color="#000000" type="text"
name="chTCK" value="<%=rtt.getString("Ticketno")%>"></td>
<td><input readonly="readonly" style=border:"0" size="8"color="#000000" type="text"
name="chDTE" value="<%=rtt.getString("Date")%>"></td>
<td><input readonly="readonly" style=border:"0" size="10" color="#000000" type="text"
name="chARR" value="<%=rtt.getString("Arrivalplace")%>"></td>
<td><input readonly="readonly" style=border:"0" size="1" color="#000000" type="text"
name="chNOS" value="<%=rtt.getString("Noseats")%>"></td>
<td><input readonly="readonly" style=border:"0" size="10" color="#000000" type="text"
name="chNME" value="<%=rtt.getString("Name")%>"></td>
<td><input readonly="readonly" style=border:"0" size="1" color="#000000" type="text"
name="chGEN" value="<%=rtt.getString("Gender")%>"></td>
<td><input readonly="readonly" style=border:"0" size="1" color="#000000" type="text"
name="chAGE" value="<%=rtt.getString("Age")%>"></td>
<td><input readonly="readonly" style=border:"0" size="10" color="#000000" type="email"
name="chEML" value="<%=rtt.getString("Email")%>"></td>
<td><input readonly="readonly" style=border:"0" size="10" color="#000000" type="text"
name="chPHN" value="<%=rtt.getString("Phno")%>"></td>
<td><input readonly="readonly" style=border:"0" size="25"color="#000000" type="text"
name="chADD" value="<%=rtt.getString("Address")%>"></td>
<td><input readonly="readonly" style=border:"0" size="10"color="#000000" type="text"
name="chALT" value="<%=rtt.getString("AltPhno")%>"></td>
<td><input readonly="readonly" style=border:"0" size="10"color="#000000" type="text"
name="chLND" value="<%=rtt.getString("Landmark")%>"></td>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 58

<td><input readonly="readonly" style=border:"0" size="8"color="#000000" type="text"


name="chCTY" value="<%=rtt.getString("City")%>"></td>
<td><input readonly="readonly" style=border:"0" size="8"color="#000000" type="text"
name="chARE" value="<%=rtt.getString("Area")%>"></td>
<td><input readonly="readonly" style=border:"0" size="4"color="#000000" type="text"
name="chPIN" value="<%=rtt.getString("Pincode")%>"></td>
<td><input readonly="readonly" style=border:"0" size="1"color="#000000" type="text"
name="chBUS" value="<%=rtt.getString("busno")%>"></td>
<td><input readonly="readonly" style=border:"0" size="1"color="#000000" type="text"
name="chAMT" value="<%=rtt.getString("Amount")%>"></td></tr>

<%
}
%>
</table>
</th>
</tr>
</table>

<hr style=color:#D3D3D3 size="2px">


</body>
</html>

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 59

SNAPSHOTS

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 60

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 61

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 62

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 63

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 64

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 65

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 66

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 67

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 68

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 69

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 70

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 71

TESTING

Unit Testing: Initial every module was tested here to detect coding errors. AlsoEvery module
is authenticated with validation using certain tools. Every
part of each module was tested here.

Integrated Testing : After Unit testing , different modules were combined to form
entire system. This testing was done to check errors that occur while interconnection of
modules. To see if all modules are working and linking properly on generation of events.

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 72

CONCLUSION

The project has been a rewarding experience in more ways than one. We have
gained a lot of knowledge in HTML, J.S, SQL and J.S.P etc. By developing the
project.

We got a platform to put in our ideas into the project. We also have
experienced that how much creative we are and we have also gained much in
developing forms.

FUTURE ENHANCEMENT

Our future enhancement would be, to develop this project using high-end
softwares so that the customer can the it from anywhere, anytime very
conveniently.

We aim to provide packages for the Customer including Hotel and Taxi services.
The customer would also be able to receive the tickets online if necessary.

We also aim to increase the security of the Customer details by using High security
techniques.

Department of Computer Science NCJ


BUS RESERVATION SYSTEM 73

BIBLIOGRAHY

The Complete Reference HTML Black Book,by Powell.

Internet and Information Technology, by M.A Rama and

www.w3schools.com.

www.google.com.

Department of Computer Science NCJ

You might also like