Sie sind auf Seite 1von 97

Mini Project Report

On

METRO RAIL MANAGEMENT


ONLINE

Submitted By:
AJMAL RAHMAN (12110004)
AKHIL G (12120093)
SANJAY P R (12120098)

In partial fulfillment for the award of the degree of

B. TECH DEGREE

In

COMPUTER SCIENCE & ENGINEERING


SCHOOL OF ENGINEERING
COCHIN UNIVERSITY OF SCIENCE & TECHNOLOGY
KOCHI-682022
MARCH 2014
Division of Computer Science

School of Engineering
Cochin University of Science & Technology
Kochi-682022

CERTIFICATE

Certified that this is a bonafide record of the project work titled

METRO RAIL MANAGEMENT ONLINE


Done by

AJMAL RAHMAN(12110004)
AKHIL G(12120093)
SANJAY PR (12120098)

of VI semester Computer Science & Engineering in the year 2014 in


partialfulfillment of the requirements for the award of Degree of Bachelor
of Technology in Computer Science & Engineering of Cochin University
of Science & Technology.

V.DAMODARAN PRAMOD PAVITHRAN


Project Guide Head of the Division
ACKNOWLEDGMENT

I take this occasion to thank God, almighty for blessing us with his

grace and taking our endeavor to a successful culmination. I extend my

sincere and heartfelt thanks to our esteemed guide, Mr. V.DAMODARAN ,

for providing me with the right guidance and advice at the crucial junctures

and for showing me the right way. I extend my sincere thanks to our

respected Head of the division Mr. PRAMOD PAVITHRAN, for allowing

us to use the facilities available. I would like to thank the other faculty

members also, at this occasion. Last but not the least, I would like to thank

my friends and family for the support and encouragement they have given

me during the course of our work.

AJMAL RAHMAN

AKHIL G

SANJAY P.R
ABSTRACT

This is an integrated service which provide all information about the metro
rail and its routes for public. The proposed system is a web based
application which provides information regarding timings, routes, fair.

This system manages public feedback about services through its complaint
management system. This system also contains an online ticket recharge
module where users can recharge their smart cards online through the site.

There is also an admin module where admin can add stations, trains, routes
and also update the fairs. The admin is a panel consisting of a group of
authorized persons.
LIST OF FIGURES

PAGE

1.1 COMPLAINT MANAGMENT MODULE 2

1.2 ONLINE TICKET RECHARGE MODULE 3

1.3 METRO TIME TABLE MODULE 4

1.4 FAIR AND ROUTE MAP MODULE 4

1.5 ADMIN MODULE 5

E-R DIAGRAMS AND DFD

3.13 COMPLETE DIAGRAM 24

3.14 COMPLAINT MANAGMENT SYSTEM DFD 26

3.15 ONLINE TICKET RECHARGE DFD 27

3.16 METRO TIME TABLE DFD 28

3.17 FAIR AND ROUTE MAP DFD 29

3.18 ADMIN DFD 30


LIST OF TABLES

PAGE

3.1 ADMIN TABLE 18

3.2 COMPLAINT DETAILS TABLE 18

3.3 FAIR DETAILS TABLE 19

3.4 METRO CARD TABLE 19

3.5 RECHARGE DETAILS TABLE 20

3.6 REPLY TABLE 20

3.7 ROUTE TABLE 20

3.8 ROUTE DETAILS TABLE 21

3.9 STATIONS TABLE 21

3.10 TRAIN TABLE 21

3.11 TRIP TABLE 22

3.12 TRIP DETAILS TABLE 22


TABLE OF CONTENTS

PAGE
ACKNOWLEDGEMENT
ABSTRACT i
LIST OF FIGURE ii
LIST OF TABLES iii

1. INTRODUCTION
1.1 OBJECTIVES 1
1.2 OVER VIEW 1
1.2.1 COMPLAINT MANAGMENT MODULE 2
1.2.2 ONLINE TICKET RECHARGE 3
1.2.3 METRO TIME TABLE 4
1.2.4 FAIR AND ROUTE MAP 4
1.2.5 ADMIN 5

2. SYSTEM ANALYSIS 6
2.1 EXISTING SYSTEM 6
2.2 PROPOSED SYSTEM 7
2.3 SYSTEM REQUIREMENT SPECIFICATION 8
2.3.1 GENERAL DESCRIPTION 8
2.3.2 SYSTEM OBJECTIVES 9
2.3.3 SYSTEM REQUIREMENTS 9
2.3.3.1 NON FUNCTIONAL REQUIREMENT 9
2.3.3.2 FUNCTIONAL REQUIREMENT 10
2.3.4 SOFTWARE AND HARDWAREREQUIREMENTS 12
2.3.4.1 SOFTWARE REQUIREMENTS 12
2.3.4.2 HARDWARE REQUIREMENTS 13

3. SYSTEM DESIGN 14

3.1 INPUT AND OUTPUT DESIGN 14

3.1.1 INPUT DESIGN 14

3.1.2 OUTPUT DESIGN 15

3.2 DATABASE 15

3.3 SYSTEM TOOLS 16

3.3.1 FRONT END 16

3.3.2 BACK END 17

3.4 TABLES 18

3.5 E-R DIAGRAMS 28

3.6 DATA FLOW DIAGRAMS (DFD) 30

3.7 SCREEN SHOTS 37


4. CONCLUSION 56

REFERENCES 57

APPENDIX 58
Metro Rail Management Online

CHAPTER 1

INTRODUCTION

This is an integrated service which provide all information about the metro
rail and its routes for public. The proposed system is a web based
application which provides information regarding timings, routes, fair.

This system manages public feedback about services through its


complaint management system. This system also contains an online ticket
recharge module where users can recharge their smart cards online
through the site.

There is also an admin module where admin can add stations, trains,
routes and also update the fairs. The admin is a panel consisting of a
group of authorized persons.

1.1 OBJECTIVE
. The objectives of the projectare as follows:

Users can register complaints through the site.


User login page where users can recharge tickets online.
Users can view metro timetable.
User can also view the fair details and the route map.
An admin login page where admin can add stations, trains,routes ,
update fairs and even add a new admin.

Division of Computer Engineering, SOE,CUSAT 1


Metro Rail Management Online

1.2 OVERVIEW

Metro Rail Management System consist of the following implementation


modules.

Fig 1.2.1 Complaint Management Module

This module contains various facilities like view complaints and reply to
complaints.

Division of Computer Engineering, SOE,CUSAT 2


Metro Rail Management Online

Fig 1.2.2 Online Ticket Recharge Module

This module contains various facilities like request for smart card,
recharge ,view balance ,view journey history.

Division of Computer Engineering, SOE,CUSAT 3


Metro Rail Management Online

Fig 1.2.3 Metro Time table module

This module contains various facilities like view time chart between two
stations.

Division of Computer Engineering, SOE,CUSAT 4


Metro Rail Management Online

Fig 1.2.4 Fair and route map module

This module contains various facilities like display fair and display route
map.

Division of Computer Engineering, SOE,CUSAT 5


Metro Rail Management Online

Fig 1.2.5 Admin module

This module contains facilities like view & reply to complaints, issue smart
card,add stations ,add train ,add routes ,add & update fair details ,add trip
and add admin.

Division of Computer Engineering, SOE,CUSAT 6


Metro Rail Management Online

CHAPTER 2

SYSTEM ANALYSIS

System analysis is the process of gathering and interpreting facts,


diagnosing problems and using the information to recommend
improvements on the system. System analysis is a problem solving
activity that requires intensive communication between the system users
and system developers.

System analysis or study is an important phase of any system


development process. The system is viewed as a whole, the inputs are
identified and the system is subjected to close study to identify the
problem areas. The solutions are given as a proposal. The proposal is
reviewed on user request and suitable changes are made. This loop ends
as soon as the user is satisfied with the proposal.

2.1 EXISTING SYSTEM

Information cannot be collected, processed and


communicated more quickly and efficiently.

Current working systems doesnt ensure that right


information reaches the right person at the right time.

Division of Computer Engineering, SOE,CUSAT 7


Metro Rail Management Online

2.2 PROPOSED SYSTEM

The proposed system is designed to eliminate the disadvantages of the


existing system.The proposed system Metro Rail Management System is
mentioned for tracing the problems in the existing system.

Increased efficiency and reliability.

Easier Access.

Easy to use

Provide accurate information to the user for taking necessary

decisions.

Accuracy - The information will be correct, accurate and

unambiguous.

Efficiency - Information can be collected, processed and

communicated more quickly and efficiently. Systems ensure

that right information reaches the right person at the right

time.

Division of Computer Engineering, SOE,CUSAT 8


Metro Rail Management Online

Reliability - Since systems are free from boredom and

tiredness, they work constantly on data to produce more

reliable outputs.

Accessibility, Usability and Understandability

The options used can be easily accessed, used and

realized.

Division of Computer Engineering, SOE,CUSAT 9


Metro Rail Management Online

2.3 SYSTEM REQUIREMENT SPECIFICATION

2.3.1 GENERAL DESCRIPTION

Product Description:
Metro rail management system is an online system which helps the user
to recharge their tickets online, it also have a complaint management
system in which users can register their complaints online.

By visiting the site the users can get metro time table. Other than that by
entering the source station and destination station the users can get all
sorts of information about trains arriving and departing from the stations,
its fair details and even it provides you the route map.

Problem Statement:
The problem occurred before having online system includes:
File lost
When online system is not implemented the complaints are reported in
files. The files are always lost due to some human errors.
Time consuming
When there is no computerized system then for recharge purposes the
users need to travel to the stations and also sometimes even need to
stand in large queues for recharge purposes.
Most updations are unnoticeable

Division of Computer Engineering, SOE,CUSAT 10


Metro Rail Management Online

When online systems is not implemented any changes in fair, timings etc
when updated ,the details of these things are only available at the
stations.

2.3.2 SYSTEM OBJECTIVES

Improvement in Control and performance


The system is developed to cope up with current issues and problems of
the metro rail. The system helps to recharge online, make a complaint
online , display metro timetable ,fairs and route maps.
Save time
User is able to recharge online, see details of metro time table , fairs &
route maps and even the user can complaint online there by saving his
valuable time.
Easy to Use
A person with just an internet connection and a pc can do things such as
complaint, recharge and view metro details very easily.

Division of Computer Engineering, SOE,CUSAT 11


Metro Rail Management Online

2.3.3 SYSTEM REQUIREMENTS

2.3.3.1 NON FUNCTIONAL REQUIREMENTS

EFFICIENCY REQUIREMENT
When a metro rail management system will be implemented then the user
can recharge, complaint and view metro information fastly& easily.
RELIABILITY REQUIREMENT
The system should accurately perform recharge, store complaints, show
the details of metro such as fair, route maps.
USABILITY REQUIREMENT
The system is designed for a user friendly environment so that user and
admin of metro rail can perform various tasks easily and in an effective
way.

IMPLEMENTATION REQUIREMENTS

In implementing whole system it uses html in front end with jsp as server
side scripting language which will be used for database connectivity and
the backend ie the database part is developed using mysql.
DELIVERY REQUIREMENTS
The whole system is expected to be delivered in six months of time with a
weekly evaluation by the project guide.

Division of Computer Engineering, SOE,CUSAT 12


Metro Rail Management Online

2.3.3.2 FUNCTIONAL REQUIREMENTS

REGISTER COMPLAINT

Description of Feature

This feature allows users to file complaints through the site. The user does
not require a registration. He can give his name, email-id, phone number,
address and other details along with the complaints. The admin will reply
to the complaints sent by user.

Functional Requirements

System must be able to verify information.


System must be able to store the information in database.
System must be able to retrieve information when required by
admin.

METRO CARD

Description of Feature

This feature allows the user to recharge their metro card online, there by
saving their valuable time. Users need to login with their card number&
password and can recharge their tickets online. It also allows them to view
their balance and journey history.

Functional Requirements

User id is provided when they register.


The system must be able to show the users balance and journey
history.
The user must be able to logout after they had finished recharging
or after viewing the balance or journey history.

Division of Computer Engineering, SOE,CUSAT 13


Metro Rail Management Online

METRO TIME TABLE

Description of feature

This feature allows the users to view the metro time table. Users are
required to enter the source station and destination station, when they
enter the data then the system will show the metro time table.

Functional Requirements

System must allow the users to enter the source station and
destination stations.
System must be able to process information from database.

FAIR AND ROUTEMAP

Description of Feature

This feature allows the users to view the fair and route map. Users are
required to enter the source and destination station, when they enter the
data then the system will display fair details and the route map.

Functional Requirements

System must allow the users to enter the source and destination
stations.
System must be able to retrieve information from the database.

Division of Computer Engineering, SOE,CUSAT 14


Metro Rail Management Online

ADMIN

Description of Feature

This feature allows the admin to view and reply to complaints. Admin can
add stations, routes ,train , trip . Admin can also add and update fair
details, and even add a new admin. Actually, the admin is a panel
consisting of a group of authorized persons.

Functional Requirements

The system must allow admin to add train, stations ,routes,fair


,metro timetable and even add a new admin.
The system must also allow admin to reply to the complaints send
by the user.
The system should be designed in such a way that only authorized
people should be allowed to access some particular modules.
The records should be modified by only administrators and no one
else.

2.3.4 SOFTWARE AND HARDWARE REQUIREMENTS


This section describes the software and hardware requirements of the
system
2.3.4.1 SOFTWARE REQUIREMENTS
Operating system- Windows 7 is used as the operating system
as it is stable and supports more features and is more user
friendly
Database MYSQL-MYSQL is used as database as it easy to
maintain and retrieve records by simple queries which are in

Division of Computer Engineering, SOE,CUSAT 15


Metro Rail Management Online

English language which are easy to understand and easy to


write.
Development tools and Programming language- HTML is used
to write the whole code and develop webpages with css,
java script for styling work and php for sever side scripting.

2.3.4.2 HARDWARE REQUIREMENTS


Intel core i3 2nd generation is used as a processor
because it is fast than other processors an provide
reliable and stable and we can run our pc for longtime.
By using this processor we can keep on developing our
project without any worries.
Ram 1 gb is used as it will provide fast reading and
writing capabilities and will in turn support in processing

Division of Computer Engineering, SOE,CUSAT 16


Metro Rail Management Online

CHAPTER 3

SYSTEM DESIGN

System design is the solution for the creation of a new system.


This phase focuses on the detailed implementation of the feasible system.
It emphasis on translating design.Specifications to performance
specification. System design has two phases of development

Logical design
Physical design

During logical design phase the analyst describes inputs (sources),


output s(destinations), databases (data sores) and procedures (data
flows) all in a format that meets the user requirements. The analyst also
specifies the needs of the user at a level that virtually determines the
information flow in and out of the system and the data resources. Here
the logical design is done through data flow diagrams and database
design. The physical design is followed by physical design or coding.
Physical design produces the working system by defining the design
specifications, which specify

exactly what the candidate system must do.The programmers write


the necessary programs that accept input from the user, perform

Division of Computer Engineering, SOE,CUSAT 17


Metro Rail Management Online

necessary processing on accepted data and produce the required report


on a hard copy or display it on the screen.

3.1 INPUT AND OUTPUT DESIGN

3.1.1 INPUT DESIGN:

Input design is the link that ties the information system into the world of its

users. The input design involves determining the inputs, validating the
data, minimizing the data entry and provides a multi-user facility.
Inaccurate inputs are the most common cause of errors in data
processing. Errors entered by the data entry operators can be
controlled by input design. The user-originated inputs are converted to a
computer based format in the input design. Input data are collected and
organized into groups of similar data. Once identified, the appropriate
input media are selected for processing. All the input data are validated
and if any data violates any conditions, the user is warned by a
message. If the data satisfies all the conditions, it is transferred to
the appropriate tables in the database. In this project the student details
are to be entered at the time of registration. A page is designed for this
purpose which is user friendly and easy to use. The design is done
such that users get appropriate messages when exceptions occur.

Division of Computer Engineering, SOE,CUSAT 18


Metro Rail Management Online

3.1.2 OUTPUT DESIGN:

Computer output is the most important and direct source of information to


the user. Output design is a very important phase since the output needs
to be in an efficient manner. Efficient and intelligible output design
improves the system relationship with the user and helps in decision
making. Allowing the user to view the sample screen is important
because the user is the ultimate judge of the quality of output. The output
module of this system is the selected notifications.

3.2 DATABASE

DATABASE DESIGN:

Databases are the storehouses of data used in the software systems. The
data is stored in tables inside the database. Several tables are
created for the manipulation of the data for the system. Two essential
settings for a database are

- the field that is unique for all the record occurrences.

-the field used to set relation between tables.

Normalization is a technique to avoid redundancy in the tables.

Division of Computer Engineering, SOE,CUSAT 19


Metro Rail Management Online

3.3 SYSTEM TOOLS

The various system tools that have been used in developing both the front
end and the back end of the project are being discussed in this chapter.

3.3.1.FRONT END:

JSP, HTML, CSS, JAVA SCRIPTS are utilized to implement the frontend.

Java Server Pages (JSP)

Different pages in the applications are designed using jsp. A Java Server
Pages component is a type of Java servlet that is designed to fulfil the role
of a user interface for a Java web application. Web developers write JSPs
as text files that combine HTML or XHTML code, XML elements, and
embedded JSP actions and commands. Using JSP, one can collect input
from users through web page.

HTML (Hyper Text Markup Language)

HTML is a syntax used to format a text document on the web.

CSS (Cascading Style Sheets)

CSS is a style sheet language used for describing the look and
formatting of a document written in a markup language.

Division of Computer Engineering, SOE,CUSAT 20


Metro Rail Management Online

Java Script

JS is a dynamic computer programming language. It is most commonly


used as part of web browsers, whose implementations allow client-side
scripts to interact with the user, control the browser, communicate
asynchronously, and alter the document content that is displayed.

3.3.2 BACK END

The back end is implemented using MySQL which is used to design the
databases.

MySQL

MySQL is the world's second most widely used open-source relational


database management system (RDBMS). The SQL phrase stands for
Structured Query Language.

An application software called wamp was used to design the tables in


MySQL.

Division of Computer Engineering, SOE,CUSAT 21


Metro Rail Management Online

3.4 TABLES

Admin

S# Name Type
1 admin_id int(11)
2 a_name varchar(25)
3 a_address varchar(75)
4 phone_num varchar(13)
5 email varchar(30)
6 Age int(11)
7 Gender varchar(6)
8 Permission int(11)
9 designation varchar(25)
10 Password varchar(30)

Fig 3.4.1 Admin Table

Division of Computer Engineering, SOE,CUSAT 22


Metro Rail Management Online

Complaints

# Name Type
1 c_id int(11)
2 u_name varchar(25)
3 u_address varchar(50)
4 phone_num varchar(13)
5 c_msg varchar(100)
6 email varchar(25)
7 age int(11)
8 status tinyint(1)
9 time timstamp

Fig 3.4.2 complaint Details table

Fair

# Name Type
1 f_id int(11)
2 fair_unit Float
3 amt_per_unit float
4 min_charge float
5 min_distance float

Fig 3.4.3 Fair Details Table

Division of Computer Engineering, SOE,CUSAT 23


Metro Rail Management Online

METRO CARD

# Name Type
1 card_id int(11)
2 card_num varchar(20)
3 u_name varchar(25)
4 u_address varchar(75)
5 age int(11)
6 gender varchar(5)
7 phone_num varchar(11)
8 email varchar(30)
9 password varchar(20)
10 card_status tinyint(1)
11 balance int(11)

Fig 3.4.4 Metro Card Table

RECHARGE _DETAILS

# Name Type
1 r-id int(11)
2 card_num int(11)
3 amount int(11)
4 date timestamp
5 r_status int(11)
6 payment_dtls varchar(30)

Fig 3.4.5 Recharge Details Table

Division of Computer Engineering, SOE,CUSAT 24


Metro Rail Management Online

Reply

# Name Type
1 r_id int(11)
2 c_id int(11)
3 r_msg text
4 admin_id int(11)

Fig 3.4.6 Reply Table

Routes

# Nmae Type
1 route_id int(11)
2 route_name varchar(30)
3 total_stations int(11)

Fig 3.4.7Route Table

Division of Computer Engineering, SOE,CUSAT 25


Metro Rail Management Online

Route_details

# Name Type
1 r_id int(11)
2 s_id int(11)
3 s_order_num int(11)
4 length_from_start Float

Fig 3.4.8 Route Details Table

Stations

# Name Type
1 stations_id int(11)
2 s_name varchar(25)
3 latitude float
4 longitude float

Fig 3.4.9 Stations Table

Trains

# Name Type
1 train_id int(11)
2 t_name varchar(15)
3 capacity int(11)

Fig 3.4.10 Train Table

Division of Computer Engineering, SOE,CUSAT 26


Metro Rail Management Online

Trip

# Name Type
1 trip_id int(11)
2 trip_code varrchar(15)
3 train_id int(11)
4 route_id int(11)

Fig 3.4.11 Trip Table

Trip details

# Name Type
1 td_id int(11)
2 trip_num int(11)
3 stations_id int(11)
4 arrival_time time
5 departure_time time

Fig 3.4.12 Trip Details Table

Division of Computer Engineering, SOE,CUSAT 27


Metro Rail Management Online

3.5 E-R DIAGRAMS

Fig 3.5.1. Complaint Management

Division of Computer Engineering, SOE,CUSAT 28


Metro Rail Management Online

Fig 3.5.1 Route& Trip Management

Division of Computer Engineering, SOE,CUSAT 29


Metro Rail Management Online

3.6 DATA FLOW DIAGRAMS

A Data Flow Diagram (DFD) is a structured analysis and design tool that
can be used for flowcharting. A DFD is a network that describes the
flow of data and the processes that change or transform the data
throughout a system. This network is constructed by using a set of
symbols that do not imply any physical implementation. It has
the purpose of clarifying system requirements and identifying major
transformations. So it is the starting point of the design phase that
functionally decomposes the requirements specifications down to the
lowest level of detail. DFD can be considered to an abstraction of the
logic of an information-oriented or a process-oriented system flow-
chart. For these reasons DFDs are often referred to as logical data flow
diagrams.

EXTERNAL ENTITY

An external entity is a source or destination of a data flow. Only those


entities which originate or receive data are represented on a data flow
diagram. The symbol used is a rectangular box.

Division of Computer Engineering, SOE,CUSAT 30


Metro Rail Management Online

PROCESS

A process shows a transformation or manipulation of data flow within the


system. The symbol used is an oval shape.

DATAFLOW

The data flow shows the flow of information from a source to its
destination. Data flow is represented by a line, with arrowheads
showing the direction of flow. Information always flows to or from a
process and may be written, verbal or electronic. Each data flow
may be referenced by the processes or data stores at its head and
tail, or by a description of its contents.

DATA STORE

A data store is a holding place for information within the system: It is


represented by an open ended narrow rectangle. Data stores may be
long-term files such as sales ledgers, or may be short-term
accumulations: for example batches of documents that are waiting to be
processed. Each data store should be given a reference followed by an
arbitrary number.

Division of Computer Engineering, SOE,CUSAT 31


Metro Rail Management Online

DATA FLOW DIAGRAM FOR COMPLAINT MANAGEMENT


SYSTEM

Fig 3.6.1 Complaint management system DFD

Division of Computer Engineering, SOE,CUSAT 32


Metro Rail Management Online

DATA FLOW DIAGRAM FOR ONLINE TICKET RECHARGE

Fig 3.6.2 Online ticket recharge DFD

Division of Computer Engineering, SOE,CUSAT 33


Metro Rail Management Online

DATA FLOW DIAGRAM FOR METRO TIME TABLE

Fig 3.6.3 Metro time table DFD

Division of Computer Engineering, SOE,CUSAT 34


Metro Rail Management Online

DATA FLOW DIAGRAM FOR FAIR & ROUTE MAP

Fig 3.6.4 Fair and route map DFD

Division of Computer Engineering, SOE,CUSAT 35


Metro Rail Management Online

DATA FLOW DIAGRAM FOR ADMIN

Fig 3.6.5 Admin DFD

Division of Computer Engineering, SOE,CUSAT 36


Metro Rail Management Online

3.7 SCREENSHOT

HOME

Division of Computer Engineering, SOE,CUSAT 37


Metro Rail Management Online

SUBMIT COMPLAINTS

Division of Computer Engineering, SOE,CUSAT 38


Metro Rail Management Online

TIMING

Division of Computer Engineering, SOE,CUSAT 39


Metro Rail Management Online

FAIR AND ROUTE

Division of Computer Engineering, SOE,CUSAT 40


Metro Rail Management Online

METRO CARD HOME

Division of Computer Engineering, SOE,CUSAT 41


Metro Rail Management Online

APPLICATION FOR METRO CARD

Division of Computer Engineering, SOE,CUSAT 42


Metro Rail Management Online

RECHARGE METRO CARD

Division of Computer Engineering, SOE,CUSAT 43


Metro Rail Management Online

BALANCE ENQUIRY

Division of Computer Engineering, SOE,CUSAT 44


Metro Rail Management Online

ADMIN LOGIN

Division of Computer Engineering, SOE,CUSAT 45


Metro Rail Management Online

ADD STATION

Division of Computer Engineering, SOE,CUSAT 46


Metro Rail Management Online

ADD ROUTE

Division of Computer Engineering, SOE,CUSAT 47


Metro Rail Management Online

ADD TRAIN

Division of Computer Engineering, SOE,CUSAT 48


Metro Rail Management Online

ADD NEW TRIP

Division of Computer Engineering, SOE,CUSAT 49


Metro Rail Management Online

UPDATE FAIR DETAILS

Division of Computer Engineering, SOE,CUSAT 50


Metro Rail Management Online

COMPLAINTS GRID

Division of Computer Engineering, SOE,CUSAT 51


Metro Rail Management Online

REPLY COMPLAINT

Division of Computer Engineering, SOE,CUSAT 52


Metro Rail Management Online

METRO CARD GRID

Division of Computer Engineering, SOE,CUSAT 53


Metro Rail Management Online

ISSUE METRO CARD

Division of Computer Engineering, SOE,CUSAT 54


Metro Rail Management Online

ADD NEW ADMIN

Division of Computer Engineering, SOE,CUSAT 55


Metro Rail Management Online

CHAPTER 4

CONCLUSION

The project entitled Metro Rail Management Onlinewas


completed successfully.

The system has been developed with much care and free of errors and at
the same time it is efficient and less time consuming. The purpose of this
project was to develop a web application for metro rail management .

This project helped us in gaining valuable information and practical


knowledge on several topics like designing web pages using html &css,
usage of responsive templates, designing of android applications, and
management of database using mysql . The entire system is secured.
Also the project helped us understanding about the development phases
of a project and software development life cycle. We learned how to test
different features of a project.

This project has given us great satisfaction in having designed an


application which can be implemented to any nearby shops or branded
shops selling various kinds of products by simple modifications.

There is a scope for further development in our project to a great extend.


A number of features can be added to the system in future like watch me
module, each admin having separate permissions.

Division of Computer Engineering, SOE,CUSAT 56


Metro Rail Management Online

REFERENCES

[1] Cody Lindley ,JavaScript Enlightenment,First Edition, ECMA-262


,2007

[2] Herbert Schildit, Java : The complete reference, 7th Edition,Mc


GrawHills, 2004

[3]Jaison Falkner and Kevin Jones,Servlets and JavaServer Pages: The


J2EE Technology Web Tier,3rd Edition,2010;

Division of Computer Engineering, SOE,CUSAT 57


Metro Rail Management Online

APPENDIX

3.8 SAMPLE CODE

1. Index page

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

pageEncoding="ISO-8859-1"%>

<%@ page import="java.util.*" language="java" %>

<%@ page import="javax.servlet.http.HttpSession"%>

<!DOCTYPE html >

<%

String currentTab = "home";

String adminFlag="false";

if(session.getAttribute("adminVar")!= null)

adminFlag=session.getAttribute("adminVar").toString();

System.out.println("session:"+adminFlag);

try

Division of Computer Engineering, SOE,CUSAT 58


Metro Rail Management Online

if(!(request.getParameter("currentTab").isEmpty()))

currentTab = request.getParameter("currentTab");

else

currentTab = "home";

catch(Exception e)

System.out.print(e);

%>

<html>

<head>

<title>Metro Rail</title>

<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />

<link rel="stylesheet" type="text/css" href="css/styles.css" />

<script language="JavaScript" type="text/javascript">

functionredirectToTab(tab)

document.getElementById("currentTab").value = tab;

document.forms["homejspform"].submit();

Division of Computer Engineering, SOE,CUSAT 59


Metro Rail Management Online

function logout()

//alert("logout");

window.location.href = "logout.jsp";

</script>

</head>

<body>

<div class="container">

<div style="float:left;width:100%;height:2px;" >

<% if(adminFlag=="false") {%>

<div class="adminLogin"><a href="#"


class="login"onClick="redirectToTab('adminLogin')">Admin</a>

</div>

<%}

else{%>

<div class="adminLogin"><a href="#" class="login"onClick="logout()">Logout</a>

</div>

Division of Computer Engineering, SOE,CUSAT 60


Metro Rail Management Online

<%} %>

</div>

<div class="header">

<img alt="" src="img/metro.jpg" style="height:100%;width:100%;">

</div>

<div class="navdiv">

<div class="main-nav">

<ul>

<li><a href="#" class="link1" onClick="redirectToTab('home')">Home</a></li>

<li><a href="#" class="link2" onClick="redirectToTab('complaints')">


Complaints</a></li>

<li><a href="#" class="link3" onClick="redirectToTab('timing')">Timing</a></li>

<li><a href="#" class="link4" onClick="redirectToTab('fair')">Fair and Route</a></li>

<li><a href="#" class="link5" onClick="redirectToTab('recharge')">Metro card</a></li>

<% if(adminFlag=="true") {%>

<li><a href="#" class="link6" onClick="redirectToTab('admin')">Admin</a></li>

<%}%>

</ul>

</div>

</div>

Division of Computer Engineering, SOE,CUSAT 61


Metro Rail Management Online

<%

if(currentTab.compareToIgnoreCase("home")==0)

%>

<div id="homeContainer" class="tabset_content" >

<jsp:include page="home.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("complaints")==0)

%>

<div id="complaintsContainer" class="tabset_content" >

<jsp:include page="complaints.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

Division of Computer Engineering, SOE,CUSAT 62


Metro Rail Management Online

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("adminLogin")==0)

%>

<div id="complaintsContainer" class="tabset_content" >

<jsp:include page="adminLogin.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("fair")==0)

%>

<div id="complaintsContainer" class="tabset_content" >

Division of Computer Engineering, SOE,CUSAT 63


Metro Rail Management Online

<jsp:include page="fair.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("timing")==0)

%>

<div id="complaintsContainer" class="tabset_content" >

<jsp:include page="timing.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("recharge")==0)

%>

Division of Computer Engineering, SOE,CUSAT 64


Metro Rail Management Online

<div id="complaintsContainer" class="tabset_content" >

<jsp:include page="metroCard.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("admin")==0)

%>

<div id="adminContainer" class="tabset_content" >

<jsp:include page="admin/admin.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<% } %>

Division of Computer Engineering, SOE,CUSAT 65


Metro Rail Management Online

<form name="homejspform" id="homejspform" method="post">

<input type="hidden" name="currentTab" id="currentTab" value="<%=


currentTab %>"/>

</form>

</div>

</body>

</html>

2. Complaint Registration
<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtml>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/complaints.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>
<scriptsrc="jquery/jquery.h5validate.js"></script>
<scripttype="text/javascript">

$(document).ready(function(){

$('Form').submit(function(event){//prevent from refresh


event.preventDefault();
});

$('#complaintForm').submit(function ()
{

$.ajax({
type: "post",
url: "addComplaintsAjax.jsp",

Division of Computer Engineering, SOE,CUSAT 66


Metro Rail Management Online

data: $("#complaintForm").serialize(),
success: function(msg){
alert(msg);
document.getElementById("user").value="";
document.getElementById("age").value="";
document.getElementById("email").value="";
document.getElementById("phone").value="";
document.getElementById("address").value="";
document.getElementById("c_msg").value="";

}
});
});
});
</script>
</head>
<body>
<divclass="complaintTable">
<formid="complaintForm"name="complaintForm"class="complaintForm"method="
post"action="">
<tablewidth="400"border="0">

<tr>
<thheight="35"align="left">
<p><b>Submit a complaint</b></p>
</th>
</tr>
<tr>
<tdheight="35"align="left">
<p>Name</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"name="user"id="user"size="30"required/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Age</p>
</td>
<tdalign="left"style="padding-left:7px;">

Division of Computer Engineering, SOE,CUSAT 67


Metro Rail Management Online

<inputtype="number"min="10"max="100"step="1"pattern="[1-9][0-
9]"placeholder="00"requiredname="age"id="age"size="30"/>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>email</p>
</td>
<tdalign="left"style="padding-left:7px;">
<inputtype="email"placeholder="Enter your
email"id="email"name="email"size="30"required/>

</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Phone number</p>
</td>
<tdalign="left"style="padding-left:7px;">

<inputtype="tel"name="phone"id="phone"size="30"placeholder="eg:
9496826455"pattern="[789][0-9]{9}"size="30"required/>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Address</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><textareaname="address"id="address"style="width: 200px;
height: 50px;" required></textarea></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Message</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><textareaname="c_msg"id="c_msg"style="width: 200px; height:


60px;" required></textarea></p>

Division of Computer Engineering, SOE,CUSAT 68


Metro Rail Management Online

</td>
</tr>
<tr>
<tdcolspan=2align="center">

<inputtype="submit"value="Submit"id="submit"/>
</td>
</tr>

</table>
</form>
</div>
</body>
</html>

3.Fair And Route details

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/fair.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>

<scriptsrc="http://maps.google.com/maps/api/js?sensor=false"type="text/j
avascript"></script>

<scripttype="text/javascript">
var map;

var count1=0;
$(document).ready(function(){

$('#find').click(function ()
{
document.getElementById("stationsHiddenDiv").innerHTML = "";
document.getElementById("map").innerHTML = "";

Division of Computer Engineering, SOE,CUSAT 69


Metro Rail Management Online

$.ajax({
type: "post",
url: "getStationsForMapAjax.jsp", //this is my servlet
data:"s_stationid="+$('#s_station').val()+"&d_stationid="+$('#d_station'
).val(),
success: function(msg){

$("#stationsHiddenDiv").append(msg);
count1=$('#count1').val();

draw();
//document.getElementById("station").value="";
//document.getElementById("latitude").value="";
//document.getElementById("longitude").value="";
}
});

});//end of click function

$.ajax({
type: "post",
url: "admin/stationSelectAjax.jsp",
data:"",
success: function(msg){
//alert(msg);
$("#s_station").append(msg);
document.getElementById("s_station").selectedIndex = -1;
$("#d_station").append(msg);
document.getElementById("d_station").selectedIndex = -1;
}
});

});

function draw(){

var locations = new Array(count1);


for (var k=0;k<count1; k++)
{
locations[k] = new Array(3);
}

Division of Computer Engineering, SOE,CUSAT 70


Metro Rail Management Online

for(var m=0,j=1;m<count1;m++,j++)
{
locations[m][0]=document.getElementById('stname'+j).value;

locations[m][1]=document.getElementById('latitude'+j).value;

locations[m][2]=document.getElementById('longitude'+j).value;

//alert(locations[m][0]+","+locations[m][1]+","+locations[m][2]);
}

map = newgoogle.maps.Map(document.getElementById('map'), {
zoom: 11,
center: newgoogle.maps.LatLng(10.04754, 76.31846),
mapTypeId: google.maps.MapTypeId.ROADMAP
});

varinfowindow = newgoogle.maps.InfoWindow();

var marker, i;

for (i = 0; i < count1; i++) {


marker = newgoogle.maps.Marker({
position: newgoogle.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});

google.maps.event.addListener(marker, 'click', (function(marker, i) {


returnfunction() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
}//end of draw

</script>
</head>
<body>
<divclass="fairTable">
<formid="fairTableForm"method="post"action="">

Division of Computer Engineering, SOE,CUSAT 71


Metro Rail Management Online

<tablewidth="500"border="0">
<tr>
<thheight="35"align="center"colspan="2">
<p>Find fair and route between two stations.
</p>
</th>
</tr>
<tr>
<tdheight="35"align="left">
<p>Source </p>
</td>
<tdalign="left">

<p><selectclass="s_station"name="s_station"id="s_station">
<option></option>
</select></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Destination</p>
</td>
<tdwidth="50%"align="left">

<p><selectclass="d_station"name="d_station"id="d_station">
<option></option>
</select></p>
</td>
</tr>
<tr>
<tdcolspan=2align="center">
<inputtype="button"value="Find"id="find"/>
</td>
</tr>

</table>
</form>
<divid="stationsHiddenDiv"name="stationsHiddenDiv">
</div>

<divid="map"style="width: 500px; height: 400px;"></div>

</div>

Division of Computer Engineering, SOE,CUSAT 72


Metro Rail Management Online

</body>
</html>

3. Application for Metrocard

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtml>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/recharge.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>
<scripttype="text/javascript">

$(document).ready(function(){

$('Form').submit(function(event){//prevent from refresh


event.preventDefault();
});

$('#metroCardApplicationForm').submit(function ()
{
$.ajax({
type: "post",
url: "addMetroCardFormAjax.jsp",
data: $("#metroCardApplicationForm").serialize(),
success: function(msg){
alert(msg);
document.getElementById("loadDiv").innerHTML
= "";

jQuery("#loadDiv").load('applicationForCard.jsp');

}
});
});
});
</script>
</head>
<body>

Division of Computer Engineering, SOE,CUSAT 73


Metro Rail Management Online

<divclass="rechargeTableDiv">
<formid="metroCardApplicationForm"method="post"action="">
<tablewidth="400"border="0">
<tr>
<thheight="35"align="left"colspan="2">
<p><b>Application for Metro card</b></p>
</th>

</tr>
<tr>
<tdheight="35"align="left">
<p>Name</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"requiredname="user"id="user"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Password</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="password"requiredname="password"id="password"size=
"30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Age</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"requiredname="age"id="age"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Gender</p>
</td>
<tdalign="left"style="padding-left:7px;">

Division of Computer Engineering, SOE,CUSAT 74


Metro Rail Management Online

<p><inputtype="text"requiredname="gender"id="gender"size="30"/></
p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Phone number</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"requiredname="phone"id="phone"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>email</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"requiredname="email"id="email"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Address</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><textareaname="address"requiredid="address"style="width:
200px; height: 50px;"></textarea></p>
</td>
</tr>
<tr>
<tdcolspan=2align="center">
<inputtype="submit"value="Submit"id="add"/>
</td>
</tr>

</table>
</form>
</div>
</body>

Division of Computer Engineering, SOE,CUSAT 75


Metro Rail Management Online

</html>

5. Database Connection

packageDataBase;

importjava.sql.*;

public class DB {

static Connection con = null;

static Statement stmt = null;

staticResultSetrs = null;

public static Connection getConnection() {

try {

Class.forName("com.mysql.jdbc.Driver");

con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/metrorail",
"root", "");

} catch (Exception e) {

System.out.println("Exception" + e);

return con;

Division of Computer Engineering, SOE,CUSAT 76


Metro Rail Management Online

public static booleanexecuteUpdate(String query) {

boolean f = false;

try {

con = getConnection();

stmt = con.createStatement();

int b = stmt.executeUpdate(query);

if (b > 0) {

f = true;

} else {

f = false;

} catch (Exception e) {

System.out.println("Exception" + e);

return f;

public static ResultSetexecuteQuery(String sql) {

try {

Division of Computer Engineering, SOE,CUSAT 77


Metro Rail Management Online

con = getConnection();

stmt = con.createStatement();

rs = stmt.executeQuery(sql);

returnrs;

} catch (Exception e) {

System.out.println("Exception" + e);

return null;

public static void close() {

try {

con.close();

stmt.close();

rs.close();

} catch (Exception e) {

System.out.println("Exception" + e);

6. Example- Informations inserting to database

Division of Computer Engineering, SOE,CUSAT 78


Metro Rail Management Online

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@pageimport="java.io.File"%>
<%@pageimport="java.sql.ResultSet"%>
<%@pageimport="DataBase.DB"%>

<%

if (DB.executeUpdate("insert into metrocard values("


+ "null" + ","
+ "null" + ",'"
+ request.getParameter("user") + "','"
+ request.getParameter("address") + "',"
+ request.getParameter("age") + ",'"
+ request.getParameter("gender") + "','"
+ request.getParameter("phone") + "','"
+ request.getParameter("email") + "','"
+ request.getParameter("password") + "',"
+ "false" + ","
+ "0" + ")"))

{
%>Aplication submitted successfully
<% }
else{%>

notsunmited<%}

%>

7. Admin login page


<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/adminLogin.css"/>
</head>
<body>

Division of Computer Engineering, SOE,CUSAT 79


Metro Rail Management Online

<divclass="tableForm">
<formid="login"method="post"action="loginServlet">
<tablewidth="300"border="0">

<tr>
<tdheight="35"align="left">
<p>User name</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"name="user"id="user"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Password</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"name="password"id="password"size="30"/></p>
</td>
</tr>
<tr>
<tdcolspan=2align="center">
<inputtype="submit"value="login"id="submit"/>
</td>
</tr>

</table>
</form>
</div>
</body>
</html>

8 .Add route page


<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>

Division of Computer Engineering, SOE,CUSAT 80


Metro Rail Management Online

<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/admin.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>
<scripttype="text/javascript">
var count=1;

$(document).ready(function(){

$('#save').click(function ()
{
document.getElementById("countnum").value = count-1;
alert(document.getElementById("countnum").value);
$.ajax({
type: "post",
url: "admin/routeSubmitAjax.jsp", //this is my servlet
data: $("#routeForm").serialize(),
success: function(msg){
alert(msg);
}
});
});

$('#add').click(function (){
var tr1=createtablerow(count);
$("#stations").append(tr1);
getOptions();
});

});
functiongetOptions()
{
var count1=count-1;
$.ajax({
type: "post",
url: "admin/stationSelectAjax.jsp", //this is my servlet
data:"",
success: function(msg){
//alert(msg);
$("#"+ count1 ).append(msg);
if(count1==1)

Division of Computer Engineering, SOE,CUSAT 81


Metro Rail Management Online

{
document.getElementById("length1").value=0;
}

}
});
}
functionautoLength(sbox)
{

var sid2=parseInt(sbox.id);
var sid1=sid2-1;
//alert("inside lengths id: "+sid2);
if(sid2!==1)
{
getDistance(sid1,sid2);
}
else
{
document.getElementById("length1").value=0;
}
}

functiongetDistance(boxid1,boxid2)
{

$.ajax({
type: "post",
url: "admin/getDistanceAjax.jsp",
data:"boxid1="+$('#'+boxid1).val()+"&boxid2="+$('#'+boxid2).val()
,
success: function(msg){
var distance=parseFloat(msg);
if(distance==1000)
{

}
else{
var
len1=parseFloat(document.getElementById("length"+boxid1).value);

distance=distance+len1;

Division of Computer Engineering, SOE,CUSAT 82


Metro Rail Management Online

document.getElementById("length"+boxid2).value=distance;
}

}
});
}
functioncreatetablerow() {

vartr = '<tr>' ;
var label1='Station'+count;
var label2="Length from start";
var id1 ='station'+count;
var id3 =count;
varid2 ='length'+count;
count++;
// create a new selectBox

varselectBox = '<select id="'+ id3 + '" onChange="autoLength(this);"


name="' + id1 + '" style="width:200px;min-width:200px;height:20px;"
/>';
varinputBox = '<input type="text" id="'+ id2 + '" name="' + id2 + '"
size="30" />';
// create a new Label Text
tr += '<td>' + label1 + '</td>';
tr += '<td>' + selectBox + '</td>';
tr += '<td>' + label2 + '</td>';
tr += '<td>' + inputBox + '</td>';
tr +='</tr>';
returntr;
}
</script>
</head>
<body>
<divid="pageContainer"class="pageContainer">
<divclass="routeTable">
<formid="routeForm"method="post"action="">
<inputtype="hidden"name="countnum"id="countnum"value="2"/>
<tableid="stations"width="400"border="0">
<tr>
<tdheight="35"align="center"colspan="2">
<b> Add new route</b>
</td>
</tr>

Division of Computer Engineering, SOE,CUSAT 83


Metro Rail Management Online

<tr>
<tdheight="35"align="left">
<p>Route name</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"name="rname"id="rname"size="30"/></p>
</td>
<td></td>
<td></td>
</tr>
</table>
<inputtype="button"value="Add station"id="add"/><br>
<inputtype="button"value="submit"id="save"/>

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

9.For getting auto fill distance when creating route

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@pageimport="java.io.File"%>
<%@pageimport="java.sql.ResultSet"%>
<%@pageimport="DataBase.DB"%>
<%@pageimport="java.io.PrintWriter"%>
<%@pageimport="java.sql.*"%>

<%

int boxid1=Integer.parseInt(request.getParameter("boxid1"));
int boxid2=Integer.parseInt(request.getParameter("boxid2"));
ResultSet rs1 = null;
ResultSet rs2 = null;
intcnt=0;
int cnt2;//first station's position in route
int cnt3;//second station's position in route
boolean flag=false;
float length1=0;

Division of Computer Engineering, SOE,CUSAT 84


Metro Rail Management Online

float length2=0;
float distance=0;

try
{
rs1=DB.executeQuery("select r_id from route_details where
s_id="+boxid1);

while(rs1.next())
{
cnt2=0;
cnt3=0;
intr_id=rs1.getInt("r_id");
rs2=DB.executeQuery("select s_id,length_from_start,s_order_num
from route_details where r_id="+r_id+" order by s_order_num ");
while(rs2.next())
{
cnt2++;
ints_id=rs2.getInt("s_id");
if(boxid1==s_id)
{
length1=rs2.getFloat("length_from_start");
break;
}

}
cnt3=cnt2;
while(rs2.next())
{
cnt3++;
ints_id=rs2.getInt("s_id");
if(boxid2==s_id)
{
flag=true;
length2=rs2.getFloat("length_from_start");
break;
}

}
if(flag==true)
{
System.out.println("ids1:"+length1);

Division of Computer Engineering, SOE,CUSAT 85


Metro Rail Management Online

System.out.println("ids1:"+length2);
distance=length2-length1;
System.out.println("ds:"+distance);
%><%=distance%>
<%
break;
}//if true

}// while rid


if(flag==false)
{
%>1000<%
}

}//try

catch(Exception e)
{
System.out.println(e);
}
%>

10.Reply complaints page

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/admin.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>

<scripttype="text/javascript">
var count=1;

$(document).ready(function(){
$("#popup_block").hide();
loadComplaintsDiv();

Division of Computer Engineering, SOE,CUSAT 86


Metro Rail Management Online

});

functionsubmitReplyForm()
{
$("#popup_block").show();
$.ajax({
type: "post",
url: "admin/submitReplyAjax.jsp", //this is my servlet
data: $("#complaintForm").serialize(),
success: function(msg){
alert(msg);
$("#popup_block").hide();
hideReplyDiv();

}
});

functionloadComplaintsDiv()
{
$.ajax({
type: "post",
url: "admin/getAllComplaintsAjax.jsp", //this is my servlet
data: "",
success: function(msg){
// alert(msg);
document.getElementById("allComplaintsDiv").innerHTML = "";
$("#allComplaintsDiv").append(msg);
}
});
}

functionloadReplyDiv(selectedId)
{
varcid=selectedId.id;
$.ajax({
type: "post",
url: "admin/getComplaintByIdAjax.jsp", //this is my servlet
data: "cid="+cid,
success: function(msg){
//alert(msg);

Division of Computer Engineering, SOE,CUSAT 87


Metro Rail Management Online

$("#allComplaintsDiv").hide();
document.getElementById("replyDiv").innerHTML = "";
$("#replyDiv").append(msg);
$("#replyDiv").show();

}
});
}
function Reply()
{
alert("hai");
}
functionhideReplyDiv()
{
$("#replyDiv").hide();
loadComplaintsDiv();
$("#allComplaintsDiv").show();
}
</script>

</head>
<body>

<divid="allComplaintsDiv">
</div>
<divid="replyDiv"style="padding-left:100px;padding-top:40px; "></div>
<divid="popup_block"class="popup_block"style="hieght:200px;width:100px;f
loat:left;position:fixed;top:50%;left:50%;z-index: 999999;">
<imgalt=""src="img/ajax-loader.gif">
</div>
</body>
</html>

Division of Computer Engineering, SOE,CUSAT 88

Das könnte Ihnen auch gefallen