BusSwap is a comprehensive web-based bus ticket reservation system. The application allows users to search for available bus routes, book tickets, manage existing bookings (update/cancel), and view ticket details.
- Search functionality: Users can search for buses based on origin and destination
- Bus route information: Display of available routes with details like departure/arrival times, duration, and price
- Ticket reservation: Book tickets with seat selection
- Ticket management: View, update, or cancel existing ticket bookings
- Responsive design: Compatible with different devices and screen sizes
- Backend: Java EE (Servlets, JSP)
- Frontend: HTML5, CSS3, JavaScript (rendered via JSP)
- Database: MySQL
- Build Tool: Maven
- Server: Apache Tomcat (recommended)
- External Libraries:
- JSTL 1.2 (JavaServer Pages Standard Tag Library)
- MySQL Connector/J 5.1.48
- Java Servlet API 3.1
- JDK 17 or above
- Maven 3.6 or above
- MySQL 5.7 or above
- Apache Tomcat 9 or above
- Install MySQL and ensure it's running
- Run the SQL script in
database_setup.sql
to create the database and tables:mysql -u root -p < database_setup.sql
-
Clone the repository:
git clone https://github.com/R-Tharanka/BusSwap-online_bus_ticket_reservation_system.git
-
Navigate to the project directory:
cd BusSwap-online_bus_ticket_reservation_system
-
Update database connection details in
src/main/java/bus_detail_package/DatabaseConnectionUtil.java
with your MySQL credentials. -
Build the project using Maven:
mvn clean package
-
Deploy the generated WAR file (from the
target
directory) to Tomcat or any Java EE compliant application server.
-
Access the application through your web browser:
http://localhost:8080/online-bus-ticket-reservation-system/
-
On the homepage, select your origin and destination from the dropdown menus.
-
Click "Search" to view available buses.
-
Select a bus route and proceed to book a ticket by providing necessary details like date and seat number.
-
View, modify, or cancel your ticket from the booking management section.
online_bus_ticket_reservation_system/
├── database_setup.sql # Database creation script
├── pom.xml # Maven configuration
├── src/
│ └── main/
│ ├── java/
│ │ └── bus_detail_package/ # Java source files
│ │ ├── bus_detail.java
│ │ ├── DatabaseConnectionUtil.java
│ │ ├── delete_ticket_control_servlet.java
│ │ ├── display_ticket_control_servlet.java
│ │ ├── search_result_control_servlet.java
│ │ ├── search_result_util.java
│ │ ├── ticket_control_servlet.java
│ │ ├── ticket_details.java
│ │ └── update_ticket_control_servlet.java
│ └── webapp/ # Web application resources
│ ├── booking.jsp
│ ├── db_failed.jsp
│ ├── index.jsp
│ ├── null_input.jsp
│ ├── privacy_policy.jsp
│ ├── search_result.jsp
│ ├── Terms_and_Conditions.jsp
│ ├── css/ # Stylesheet files
│ ├── img/ # Image resources
│ ├── META-INF/
│ └── WEB-INF/
│ ├── web_search.xml # Web application configuration
│ └── lib/ # Required library JAR files
│ ├── javax.servlet-3.1.jar
│ ├── jstl-1.2.jar
│ ├── jstl-api-1.2.jar
│ ├── mysql-connector-java-5.1.48-bin.jar
│ └── servlet-api.jar
├── target/ # Build output directory
└── online-bus-ticket-reservation-system.war
The src/main/webapp/WEB-INF/lib
directory contains the following JAR files necessary for the application:
- javax.servlet-3.1.jar: Java Servlet API implementation
- jstl-1.2.jar: JavaServer Pages Standard Tag Library implementation
- jstl-api-1.2.jar: JavaServer Pages Standard Tag Library API
- mysql-connector-java-5.1.48-bin.jar: JDBC driver for MySQL
- servlet-api.jar: Servlet API for web application development
These libraries are automatically included in the deployed WAR file.
- User selects origin and destination on the home page
- System searches for available buses matching the criteria
- User selects a bus and provides ticket details (date, seat number)
- System creates and displays the ticket
- User can view, update, or delete the ticket
Stores information about bus routes:
id
: Primary keyorigin
: Departure locationdestination
: Arrival locationstart_time
: Departure timeend_time
: Arrival timeduration
: Journey durationseats
: Total seats availableprice
: Ticket price
Stores booked ticket information:
t_id
: Primary keybus_id
: Bus identifiers_time
: Start timeorigin
: Departure locationdate
: Journey dateduration
: Journey duratione_time
: End timedestination
: Arrival locationseat_no
: Selected seat numberprice
: Ticket price
For any inquiries, please open an issue on the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.
- Ruchira Tharanka - ruchiratharanka1@gmail.com (Project Creator)