The Final task of the EPAM external course
This project is a web application implementation of a cinema WebApp using Java Servlet API. In a nutshell, there are movies and their sessions, which you can search for using filters, then select needed one, choose seats and buy tickets. But first, you should sign up/in. After purchase, you can find your tickets on the user ticket page and download them in PDF format. Admin can add/remove new movies and movie sessions as well.
- Introduction
- Technologies
- How to install/run
- What was implemented
- Entity–relationship model of the database
- Demonstration
- Tests
- Author
The system is an online showcase of a single-screen cinema.
- Unauthorized user (guest)
- Authorized user (customer)
- Administrator
- Schedule current films for a week from 9:00 a.m. to 10:00 p.m. (beginning of the last film).
- An unauthorized user can see the session schedule, and available seats for current movies, and has the opportunity to sign up. The user should be able to sort the movie sessions' schedule by
- the movie name;
- the number of available seats;
- the date/time of the session (by default); as well as filter available movies (due to empty seats) in the schedule.
- A signed-up user has to be able to purchase a ticket for the selected movie session.
- The administrator can add a new movie to the schedule, cancel the movie, and review the attendance of the hall.
- Back end: Java, Java 8, Jakarta EE, Jakarta Servlet, Servlet Filters; JDBC, SQL; JUnit, Mockito; Log4j2 SLF4J; Google reCaptcha; iText PDF.
- Front end: JSP, JSTL; CSS, Bootstrap 4.
- Database Management System: MySQL
- Fork this repository.
- Clone the repository on your machine
- Make sure you have at least v.10.0.26 of Apache Tomcat Server (may be downloaded from this link) and MySQL Server at least v.8.0.29
- Using MySQL Workbench (or another tool), import the database schema and data dump from file
cinema-webapp-java/src/sql/cinema_db_{DATE}.sql
. IMPORTANT: if the dates and times of the sessions are outdated they will no longer be shown on the session page, so in such case, you need to change the dates of the sessions manually. - If needed, change the Database name and credentials in file
cinema-webapp-java/src/main/resources/db.properties
- Also be aware of the log files will be saved to
E:\\logs
folder, so you can change the path in filecinema-webapp-java-servlet/src/main/resources/log4j.properties
- Add Tomcat Configuration and Run the app. How to run the project right after downloading:
- After running, point your browser to http://localhost:8090/cinema-webapp-java-servlet/.
- Designed and built the application and database scheme
- Used patterns such as MVC, Front Controller, Factory Method, Singleton, Abstract Factory, DAO, PRG (Post/Redirect/Get)
- Implemented Database ConnectionPool with Apache Commons DBCP BasicDataSource using Singleton pattern
- Implemented logging in Console and Files using Log4j2 SLF4J
- Implemented authentication and authorization systems
- Implemented user permissions and page access using Servlet Filter
- Implemented back-end data validation (partially using front-end validation with HTML)
- Added Google reCaptcha validation during user sign up
- Implemented password encryption using a salt value for hashing
- Implemented JDBC transactions
- Implemented pagination and schedule filtering/sorting at the back-end side using SQL
- Implemented Ukrainian and English localizations using ResourceBundle and JSTL
- Implemented Cookies support for localization and user session
- Added PDF ticket creation using iTextPDF
- Implemented exception handling mechanism with the custom class handler redirecting to the error page
- Covered the application with tests using JUnit4 and Mockito
- Created custom JSP tag files for header, menu, and footer
- Created custom JSP tags for movie genres enumeration and pagination block
There are entities: Film, Genre, Session, Seat, Ticket, User, and its Role.
Firstly, the site is multilingual: Ukrainian and English versions. Everything has been translated, except errors and database data. The user lang option is stored in a cookie file.
This is the main page where you can see a list of current films. Films list is paginated just like sessions and user tickets are.
The next stop is the Schedule page, where you can see a session schedule and choose which one to buy. Sorting and filtering options help you with that, which are implemented using SQL queries.
But only authorized users can buy a ticket, so you have to sign up first. There are backend and frontend (partly) validations, and Google reCaptcha is also used. All fields, except phone number, are required.
If Google reCaptcha wasn't checked - the server return error.
Let's try to log out and sign in again. Cookie files save the user role and user id what lets the user stay signed in.
After choosing a session, you pick wanted remained seats and then confirm your purchase.
You also may download the ticket in PDF format. (Sending via email wasn't implemented)
Tests were written using the Mockito and JUnit frameworks. More than 50% of code lines are covered.
You can get in touch with me on my LinkedIn Profile:
You can also follow my GitHub Profile to stay updated about my latest projects:
If you liked the repo then kindly support it by giving it a star ⭐