MCA-01 Vehicle Management System
1 | P a g e
Dharmsinh Desai University
TERM WORK
Submitted To:
Prof. Utsav Patel
Prof. Tulsi Desai
Submitted By:
Anup Kurup (MCA V - 01)
MCA-01 Vehicle Management System
2 | P a g e
Index
1) Project Overview
2) Technologies Used
3) Database
4) Screenshots
5) Code
MCA-01 Vehicle Management System
3 | P a g e
Project Overview Objective The main objective of system is to enhance and upgrade the existing system by
increasing its efficiency and effectiveness.
The system automates each and every activity of the manual system and
increases its throughput. Thus the response time of the system is very less and it
works very fast.
The system provides a quick response with very accurate information regarding
the users etc. Any details or system in an accurate manner, as and when
required.
The transaction reports of the system can be retrieved as and when required.
Thus, there is no delay in the availability of any information, whatever needed,
can be captured very quickly and easily.
Project Description The user have to compulsory register n login to the system before booking for a
vehicle.
This system allows user to book a vehicle according to his requirement.
The user can search for the flights available in the selected city and select from
the available flight categories.
The user can also change his password and can also give his feedback.
Technology Used Language : Advance Java
Tool : Textpad
Database : Ms Access
MCA-01 Vehicle Management System
4 | P a g e
Database User:- This table stores the details of user.
Column Type Constraints id AutoNumber Primary key
Username Text Not null
firstname Text Not null
lastname Text Not null
password Text Not null
Question Long text Not null
Answer Text Not null
City :- This table stores the details of city.
Column Type Constraints City_id AutoNumber Primary key
Cityname Text Not null
Vehicle_Category:- This table stores the various categories of vehicles available.
Column Type Constraints Vehiclecat_id AutoNumber Primary key
Vehiclecat_name Text Not null
Vehicle:- This table stores the details of vehicle.
Column Type Constraints Vehicle_id Autonumber Primary key
Vehicle_name Text Not null
Vehiclecat_id number Not null, Foreign Key
Fare number Not null
City_id number Not null,foreign key
MCA-01 Vehicle Management System
5 | P a g e
booking:- This table stores the booking details of vehicle from user.
feedback:- This table stores the feedbacks given by user.
Column Type Constraints feedback_id Autonumber Primary key
User_id Text Not null, foreign key
Name Text Not null
Desc Text Not null
City_id number Not null,foreign key
Column Type Constraints booking_id Autonumber Primary key
username Text Not null,foreign key
S_loc Text Not null
Vehicle_id number Not null, foreign key
Start_date Date/time Not null
End_date Date/time Not null
MCA-01 Vehicle Management System
22 | P a g e
Code
Dbcommon.jsp <%
class DBCommon
{
private String DatabaseUserName="root";
private String DatabasePassword="";
private String DatabaseName="vehicle";
private String DriverName="sun.jdbc.odbc.JdbcOdbcDriver";
private Connection con=null;
private ResultSet rst=null;
private Statement stmt=null;
public String status;
public String errormsg;
public String sqlstr;
DBCommon()
{
try
{
Class.forName(DriverName).newInstance();
con = DriverManager.getConnection("jdbc:odbc:vehiclemanagement");
stmt=con.createStatement();
}
catch(Exception ex)
{
MCA-01 Vehicle Management System
23 | P a g e
errormsg=ex.getMessage().toString();
}
}
public void executeInsertQuery(SqlDataContainer objData)
{
sqlstr="";
sqlstr="insert into "+objData.tableName+" (";
String fieldsName="";
String fieldsValue="";
for(int i=0;i<objData.totalFields;i++)
{
fieldsName=fieldsName+objData.fiedsName[i].toString()+",";
fieldsValue=fieldsValue+"'"+objData.fiedsValue[i].toString()+"',";
}
fieldsName=fieldsName.substring(0,fieldsName.length()-1);
fieldsValue=fieldsValue.substring(0,fieldsValue.length()-1);
sqlstr=sqlstr+fieldsName+") values("+fieldsValue+")";
try
{
stmt=con.createStatement();
stmt.executeUpdate(sqlstr);
status="success";
}
catch(Exception ex)
{
status="fail";
errormsg=ex.getMessage().toString();
}
}
public void executeUpdateQuery(SqlDataContainer objData)
{
sqlstr="update "+objData.tableName+" set ";
MCA-01 Vehicle Management System
24 | P a g e
for(int i=0;i<objData.totalFields;i++)
{
sqlstr=sqlstr+objData.fiedsName[i].toString()+"='"+objData.fiedsValue[i].toString()+"',";
}
sqlstr=sqlstr.substring(0,sqlstr.length()-1);
if(objData.Condition != null)
sqlstr=sqlstr+" "+objData.Condition;
try
{
stmt=con.createStatement();
stmt.executeUpdate(sqlstr);
status="success";
}
catch(Exception ex)
{
status="fail";
errormsg=ex.getMessage().toString();
}
}
public void executeDeleteQuery(SqlDataContainer objData)
{
sqlstr="delete from "+objData.tableName;
if(objData.Condition != null)
sqlstr=sqlstr+" "+objData.Condition;
try
{
stmt=con.createStatement();
stmt.executeUpdate(sqlstr);
status="success";
}
catch(Exception ex)
{
status="fail";
MCA-01 Vehicle Management System
25 | P a g e
errormsg=ex.getMessage().toString();
}
}
public void executeSelectQuery()
{
try
{
rst=stmt.executeQuery(sqlstr);
}
catch(Exception ex)
{
errormsg=ex.getMessage().toString();
rst=null;
}
}
public void getSingleDatabaseValue(String TableName,String FieldName,String Condition)
{
try
{
sqlstr="";
sqlstr="select "+FieldName+ " from "+TableName + " where 1=1 "+Condition;
executeSelectQuery();
rst.next();
}
catch(Exception ex)
{
errormsg=ex.getMessage().toString();
rst=null;
}
}
}
%>
MCA-01 Vehicle Management System
26 | P a g e
SQLContainer.jsp
<%
class SqlDataContainer {
public String tableName = null;
public int totalFields;
public String fiedsName[]=null;
public String fiedsValue[]=null;
public String Condition=null;
public SqlDataContainer(int NoOfFields)
{
totalFields=NoOfFields;
fiedsName = new String[NoOfFields];
fiedsValue = new String[NoOfFields];
}
}
%>
MCA-01 Vehicle Management System
27 | P a g e
Register.jsp
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@include file="SqlDataContainer.jsp" %>
<%@include file="DBCommon.jsp" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Calendar" %>
<%
SqlDataContainer obj_SqlDataContainer=new SqlDataContainer(7);
DBCommon obj_DBCommon= new DBCommon();
String oper1 = "";
String reg_id = "";
String name = "";
String username1 = "";
String pswd1 = "";
String email = "";
String contact_no = "";
String question_id = "";
String answer = "";
if(request.getParameter("oper") != null)
oper1 = request.getParameter("oper");
if(request.getParameter("reg_id") != null)
reg_id = request.getParameter("reg_id");
if(request.getParameter("name") != null)
name = request.getParameter("name");
if(request.getParameter("username1") != null)
MCA-01 Vehicle Management System
28 | P a g e
username1 = request.getParameter("username1");
if(request.getParameter("pswd1") != null)
pswd1 = request.getParameter("pswd1");
if(request.getParameter("email") != null)
email = request.getParameter("email");
if(request.getParameter("contact_no") != null)
contact_no = request.getParameter("contact_no");
if(request.getParameter("question_id") != null)
question_id = request.getParameter("question_id");
if(request.getParameter("answer") != null)
answer = request.getParameter("answer");
obj_SqlDataContainer.tableName = "registration";
obj_SqlDataContainer.fiedsName[0] = "name";
obj_SqlDataContainer.fiedsValue[0] = name;
obj_SqlDataContainer.fiedsName[1] = "username";
obj_SqlDataContainer.fiedsValue[1] = username1;
obj_SqlDataContainer.fiedsName[2] = "pswd";
obj_SqlDataContainer.fiedsValue[2] = pswd1;
obj_SqlDataContainer.fiedsName[3] = "email";
obj_SqlDataContainer.fiedsValue[3] = email;
obj_SqlDataContainer.fiedsName[4] = "contact_no";
obj_SqlDataContainer.fiedsValue[4] = contact_no;
obj_SqlDataContainer.fiedsName[5] = "question_id";
obj_SqlDataContainer.fiedsValue[5] = question_id;
obj_SqlDataContainer.fiedsName[6] = "answer";
obj_SqlDataContainer.fiedsValue[6] = answer;
if(oper1.compareTo("save")==0)
{
obj_DBCommon.executeInsertQuery(obj_SqlDataContainer);
}
if(oper1.compareTo("update")==0)
MCA-01 Vehicle Management System
29 | P a g e
{
obj_SqlDataContainer.Condition="where reg_id='"+reg_id+"'";
obj_DBCommon.executeUpdateQuery(obj_SqlDataContainer);
}
if(oper1.compareTo("delete")==0)
{
obj_SqlDataContainer.Condition="where reg_id='"+reg_id+"'";
obj_DBCommon.executeDeleteQuery(obj_SqlDataContainer);
}
%>
MCA-01 Vehicle Management System
30 | P a g e
Login.jsp
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@include file="SqlDataContainer.jsp" %>
<%@include file="DBCommon.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Login page</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {color: #CC6600}
-->
</style>
<%
String msg_login1="";
String msg1_login1="";
String msg2_login1="";
String missed_passwd ="";
if( request.getParameter("msg")!=null)
MCA-01 Vehicle Management System
31 | P a g e
{
msg_login1 = request.getParameter("msg");
msg1_login1="success";
}
String oper_login1 = request.getParameter("oper");
String username_login1= request.getParameter("username");
String pswd_login1= request.getParameter("pswd");
String user;
String paswd;
if(oper_login1!=null)
{
DBCommon obj_SqlDataContainer_rec_login= new DBCommon();
try
{
if(oper_login1.compareTo("login")==0)
{
msg1_login1="fail";
obj_SqlDataContainer_rec_login.sqlstr="select * from registration where
username='"+username_login1+"' and pswd='"+pswd_login1 +"'";
obj_SqlDataContainer_rec_login.executeSelectQuery();
if( obj_SqlDataContainer_rec_login.rst.next())
{
msg1_login1="success";
session.setAttribute("username",obj_SqlDataContainer_rec_login.rst.getString("username"));
session.setAttribute("reg_id",obj_SqlDataContainer_rec_login.rst.getInt("reg_id"));
if((username_login1.compareTo("admin"))==0)
{
response.sendRedirect("admin/admin_home.jsp");
}
else
{
response.sendRedirect("mainprofile.jsp");
}
MCA-01 Vehicle Management System
32 | P a g e
}
}
}
catch(Exception ex)
{
out.println("Unable to connect to database."+ex.getMessage());
}
}
%>
</head>
<body>
<!-- start header -->
<%@include file="header.jsp" %>
<!-- end header -->
<hr />
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
<div class="post">
<h1 align="center" class="title"><strong>Login Here.....!</strong></h1>
<p> </p>
<form action="" method="get" name="abc" >
<div class="loginpgblock">
<div align="center">
<%
if(msg1_login1 == "success")
{
out.println("<div class='successmsg'><span>"+msg_login1+"</span></div>");
}
if(msg1_login1=="fail")
{
MCA-01 Vehicle Management System
33 | P a g e
out.println("<div class='errormsg'><span>Invalid username or/and
Password.</span></div>");
}
%>
<table width="295" border="0">
<tr>
<td width="109" height="31">User Name:</td>
<td width="176"><label for="user"></label>
<input type="text" name="username" id="username" /></td>
</tr>
<tr>
<td height="32">Password :</td>
<td><label for="pswd"></label>
<input type="password" name="pswd" id="pswd" /></td>
</tr>
<tr>
<td height="32" colspan="2"> </td>
</tr>
</table>
<input type="hidden" name="oper" value="login" />
<input type="submit" name="Submit" id="btnSubmit" class="blue_btn" style="width:100px;"
onclick="return valid_frm(document.form1);" value="Submit" />
</div>
<div class="margintop12">
<div align="center">
<p><a href="forget-password.jsp" class="underline">Forgot Password?</a></p>
</div>
</div>
<div align="center">
<p><img src="images/350x250_realhound01.gif" alt="" width="597" height="230" id="asdxcv"
align="middle" /></p>
</div>
</div>
</form>
MCA-01 Vehicle Management System
34 | P a g e
</div>
</div>
<div>
</div>
<!-- end content -->
<!-- start sidebar two -->
<div id="sidebar2" class="sidebar">
<ul>
<li>
<div class="margintop12"></div>
<h2>phone-booking</h2>
</li>
</ul>
<p><img name="" src="images/sidecall.png" width="295" height="78" alt="" />
</label>
</p>
</div>
<!-- end sidebar two -->
<div style="clear: both;"> </div>
</div>
<!-- end page -->
<hr />
<!-- start footer -->
<%@include file="footer.jsp" %>
<!-- end footer -->
</body>
</html>
MCA-01 Vehicle Management System
35 | P a g e
Change Password
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@include file="SqlDataContainer.jsp" %>
<%@include file="DBCommon.jsp" %>
<%@page import="java.text.SimpleDateFormat" %>
<%@page import="java.util.Calendar" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%
/* String reg_id2 = "";
if (session.getAttribute("reg_id") != null)
{
reg_id2 = session.getAttribute("reg_id").toString();
}
else
{
reg_id2 = "1001";
response.sendRedirect("new_home.jsp");
}*/
%>
<%
String pswd = "";
String oper = "";
String msg="";
DBCommon obj_DBCommon111 = new DBCommon();
if (request.getParameter("oper") != null)
{
MCA-01 Vehicle Management System
36 | P a g e
oper = request.getParameter("oper");
}
String reg_id3=session.getAttribute("reg_id").toString();
if (request.getParameter("newpswd") != null)
{
pswd = request.getParameter("newpswd");
}
if (oper.compareTo("confrmpswd") == 0)
{
msg="fail";
SqlDataContainer obj_SqlDataContainer = new SqlDataContainer(1);
DBCommon obj_DBCommon = new DBCommon();
obj_SqlDataContainer.tableName = "registration";
obj_SqlDataContainer.fiedsName[0] = "pswd";
obj_SqlDataContainer.fiedsValue[0] = pswd;
obj_SqlDataContainer.Condition = "where reg_id =" + reg_id3 + "";
obj_DBCommon.executeUpdateQuery(obj_SqlDataContainer);
msg="success";
}
%>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Anup Cabs</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<link href="css/green1.css" rel="stylesheet" type="text/css" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<link href="css/green1.css" rel="stylesheet" type="text/css" />
<link href="css/new.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="ui/css/sleek/style.css"/>
<script src="ui/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="ui/jquery-ui-1.7.1.custom.js" type="text/javascript"></script>
MCA-01 Vehicle Management System
37 | P a g e
<script src="js/components.js" type="text/javascript"></script>
<script src="js/effects.js" type="text/javascript"></script>
<style type="text/css">
<!--
.style2 {color: #CC6600}
-->
</style>
<script type="text/javascript" language="javascript" src="new-validate.js"></script>
<script language="javascript" type="text/javascript">
function valid_frm(f)
{
var valid_i=0;
valid_i += isBlank(f.oldpswd,"Please Specify Password","errvoldpswd");
valid_i += isBlank(f.newpswd,"Please Re Enter Password","errvnewpswd");
valid_i += ispwdcompare(f.confrmpswd,f.newpswd,"BOTH PASSWORDS ARE
DIFFRENT.","errvconfrmpswd");
_sum = valid_i;
if(_sum > 0)
{
return false;
}
else
{
document.form1.submit();
}
}
</script>
</head>
<body>
<!-- start header -->
<%@include file="header-profile.jsp" %>
MCA-01 Vehicle Management System
38 | P a g e
<!-- end header -->
<div id="page">
<%
if(msg=="success")
{
out.println("<p class='success'>Your Passwod has been Changed !!!<span>X</span></p>");
}
if(msg=="fail")
{
out.println("<p class='error'>"+obj_DBCommon111.errormsg+"<span>X</span></p>");
}
%>
<!-- start page -->
<!-- start content -->
<div id="content">
<div class="post">
<table width="671" height="48" border="1" bordercolor="#993333">
<tr bgcolor="#FFCC66">
<td width="199" align="center" bgcolor="#000000"><a href="mainprofile.jsp"><font
color="#ACF69F" size="+1"><strong>My Profile</strong></font></a></td>
<td width="234" align="center" bgcolor="#000000"><a href="change-
pswd.jsp"><strong><font color="#ACF69F" size="+1">Change
Password</font></strong></a></td>
<td width="216" align="center" bgcolor="#000000"><a href="feedbak.jsp"><strong><font
color="#ACF69F" size="+1">Feedback</font></strong></a></td>
</tr>
</table>
</div>
<form action="" method="get" name="form1" class="nice" id="form1">
<div class="entry">
<table width="666" border="0">
<tr>
<td width="189" height="41"><strong>Old Password</strong>:</td>
<td width="461"><label for="oldpswd"></label>
MCA-01 Vehicle Management System
39 | P a g e
<input type="Password" name="oldpswd" id="oldpswd" /> <span id="errvoldpswd"
class="required"></span></td>
</tr>
<tr>
<td height="41"><strong>New Password:</strong></td>
<td><label for="newpswd"></label>
<input type="Password" name="newpswd" id="newpswd"/> <span id="errvnewpswd"
class="required" ></span></td>
</tr>
<tr>
<td height="41"><strong>Confirm New Password:</strong></td>
<td><label for="confrmpswd"></label>
<input type="Password" name="confrmpswd" id="confrmpswd" /><span
id="errvconfrmpswd" class="required"></span></td>
</tr>
<tr>
<input type="hidden" name="oper" id="oper" value="confrmpswd" />
<input type="submit" name="save" id="save" value="Save" onClick="return
valid_frm(document.form1);">
</td>
</tr>
</table>
</div>
</form>
</div>
<div></div>
<!-- end content -->
<!-- start sidebar two -->
<div id="sidebar2" class="sidebar">
</div>
<!-- end sidebar two -->
<div style="clear: both;"> </div>
</div>
MCA-01 Vehicle Management System
40 | P a g e
<!-- end page -->
<hr />
<!-- start footer -->
<%@include file="footer.jsp" %>
<!-- end footer -->
</body>
</html>
MCA-01 Vehicle Management System
41 | P a g e
Search.jsp <%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%@include file="SqlDataContainer.jsp" %>
<%@include file="DBCommon.jsp" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Calendar" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%
String msg_not="fail";
String OtherCondition = "";
String s_cityid = "";
String d_cityid = "";
String departure_date = "";
String journey_date="";
if (request.getParameter("s_cityid") .compareTo("-1")!=0)
{
s_cityid = request.getParameter("s_cityid");
OtherCondition = OtherCondition + " AND `cityid` =" + s_cityid;
}
if (request.getParameter("d_cityid").compareTo("-1")!=0 )
{
d_cityid = request.getParameter("d_cityid");
OtherCondition = OtherCondition +" AND `v_id`=" + d_cityid;
}
MCA-01 Vehicle Management System
42 | P a g e
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Anup Cabs</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--.style2 {color: #CC6600}-->
</style>
<script type="text/javascript" language="javascript" src="new-validate.js"></script>
<script type="text/javascript">
function MM_openBrWindow(winName,features)
{
var theURL="";
}
function redirect()
{
var url="mainprofile.jsp";
window.location=url;
}
</script>
<script language="javascript" type="text/javascript">
</script>
</head>
<body>
<!-- start header -->
<%@include file="header-profile.jsp" %>
MCA-01 Vehicle Management System
43 | P a g e
<!-- end header -->
<hr />
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
<div class="post">
<h1 class="title">Search Cabs.....</h1>
<p class="meta"> </p>
<div class="entry">
<p>
<div class="fl homepage7">
<div class="homepage16">
<div class="fl homepage1" style=""></div>
</div>
<div class="homepage2">
<form action="book_cab.jsp" method="POST" >
<div class="h80" style="padding:5px 0 0 10px;">
<div class="h30">
<div class="fl"></div>
</div>
</div>
<div style="padding:5px 0 0 10px;height:1000px;">
<%
DBCommon obj_SqlDataContainer_route = new DBCommon();
obj_SqlDataContainer_route.sqlstr = "select * from vehicle WHERE 1=1 " +
OtherCondition;
//out.println(obj_SqlDataContainer_route.sqlstr );
try
{
obj_SqlDataContainer_route.executeSelectQuery();
//out.println(obj_SqlDataContainer_route.sqlstr);
MCA-01 Vehicle Management System
44 | P a g e
msg_not="fail";
while (obj_SqlDataContainer_route.rst.next())
{
msg_not="sucess";
session.setAttribute("vehicle_id",obj_SqlDataContainer_route.rst.getString("vehicle_id"));
//out.println(session.getAttribute("vehicle_id"));
%>
<table width="634" height="150" border="0">
<tr>
<td width="18"></td>
<td width="120">
<strong>Vehicle Name :</strong></td>
<td width="249"><%
out.println(obj_SqlDataContainer_route.rst.getString("vehicle_name"));%></td>
<td colspan="3" rowspan="5"><img
src="images/<%out.println(obj_SqlDataContainer_route.rst.getString("v_photo")); %>" alt="Image
not available" width="200" height="150" id="flight_photo" /></td>
</tr>
<tr>
<td width="18"></td>
<td width="106">
<strong>Fare : </strong>
</td>
<td width="249">
<% out.println(obj_SqlDataContainer_route.rst.getString("fare"));%>/km
</td>
<td></td>
</tr>
<tr>
<td width="18"></td>
<td width="106">
<a class="underline fontbig" href="javascript:void(0);" style="cursor:pointer;" >
MCA-01 Vehicle Management System
45 | P a g e
<input type="submit" name="Book Cab" id="book_cab" value="Book Cab" />
</a>
</td>
<td> </td>
<td> </td>
</tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
</table>
<%
}
if(msg_not=="fail")
{
%>
<script>
alert("Cab is not available for your selected city or type.");
redirect();
</script>
</div>
<div style="padding:10px 0 0 10px;" class="h50"></div>
<input name="src" id="src" value="h" type="hidden">
</form>
</div>
</div><br />
<br />
<h2> </h2>
<h2> </h2>
<h2> </h2>
<h2> </h2>
<h2> </h2>
<p> </p>
</div>
MCA-01 Vehicle Management System
46 | P a g e
</div>
</div>
<!-- end content -->
<!-- start sidebar two -->
<div id="sidebar2" class="sidebar">
<!--<%@include file="sidebar_logged_in.jsp" %>-->
</div>
<!-- end sidebar two -->
<div style="clear: both;"> </div>
</div>
<!-- end page -->
<hr />
<!-- start footer -->
<%@include file="footer.jsp" %>
<!-- end footer -->
</body>
</html>
<% //out.println("<div class='errormsg'><span>Flight is not available for your selected route,Try
another day for your journey.</span></div>");
}
}
catch(Exception ex)
{
out.println("Unable to connect to database."+ex.getMessage());
}
%>
</div>
<div style="padding:10px 0 0 10px;" class="h50"></div>
<input name="src" id="src" value="h" type="hidden">
</form>
</div>
<div>
MCA-01 Vehicle Management System
47 | P a g e
<p align="center"> </p>
</div>
</div><br />
<br />
</div>
</div>
</div>
<!-- end content -->
<!-- start sidebar two -->
<div id="sidebar2" class="sidebar">
</div>
<!-- end sidebar two -->
<div style="clear: both;"> </div>
</div>
<!-- end page -->
<hr />
<!-- start footer -->
<%@include file="footer.jsp" %>
<!-- end footer -->
</body>
</html>
MCA-01 Vehicle Management System
48 | P a g e
Booking.jsp <%
SqlDataContainer obj_SqlDataContainer_booking=new SqlDataContainer(5);
DBCommon obj_DBCommon_book= new DBCommon();
String reg_genrl_id=session.getAttribute("reg_id").toString();
String r_id50=session.getAttribute("route_id").toString();
String oper = "";
String book_id="";
String reg_id="";
String no_of_seat ="";
String r_id="";
String bus_id = "";
String total_price = "";
String bus_str="";
String selected_seat="";
if(request.getParameter("selected_seat") != null)
selected_seat = request.getParameter("selected_seat");
if(request.getParameter("oper") != null)
oper = request.getParameter("oper");
if(request.getParameter("book_id") != null)
book_id = request.getParameter("book_id");
if(request.getParameter("pf") != null)
no_of_seat = request.getParameter("no_of_seat");
if(request.getParameter("pf") != null)
bus_str = request.getParameter("pf");
if(request.getParameter("r_id") != null)
r_id = request.getParameter("r_id");
MCA-01 Vehicle Management System
49 | P a g e
if(request.getParameter("bus_id") != null)
bus_id = request.getParameter("bus_id");
if(request.getParameter("total_price") != null)
total_price = request.getParameter("total_price");
obj_SqlDataContainer_booking.tableName = "booking";
obj_SqlDataContainer_booking.fiedsName[0] = "reg_id";
obj_SqlDataContainer_booking.fiedsValue[0] = reg_genrl_id;
obj_SqlDataContainer_booking.fiedsName[1] = "no_of_seat";
obj_SqlDataContainer_booking.fiedsValue[1] = no_of_seat;
obj_SqlDataContainer_booking.fiedsName[2] = "r_id";
obj_SqlDataContainer_booking.fiedsValue[2] = r_id;
obj_SqlDataContainer_booking.fiedsName[3] = "bus_id";
obj_SqlDataContainer_booking.fiedsValue[3] = bus_id;
obj_SqlDataContainer_booking.fiedsName[4] = "total_price";
obj_SqlDataContainer_booking.fiedsValue[4] = total_price;
if(oper.compareTo("save")==0)
{
obj_DBCommon_book.executeInsertQuery(obj_SqlDataContainer_booking);
out.println(obj_DBCommon_book.sqlstr);
out.println(obj_DBCommon_book.errormsg);
response.sendRedirect("booking_report.jsp?no_of_seat1="+no_of_seat+"&bus_id="+bus_id+"&tot
al_price1="+total_price+"&pf="+bus_str+"&selected_seat="+selected_seat);
}
if(oper.compareTo("update")==0)
{
obj_SqlDataContainer_booking.Condition="where book_id='"+book_id+"'";
obj_DBCommon_book.executeUpdateQuery(obj_SqlDataContainer_booking);
}
if(oper.compareTo("delete")==0)
{