Casino App using Java

Stats page for Casino App

Together with a classmate in my Advance Java class at Cal Poly Pomona, I built a simple Java Web Casino App that allows users to play poker, craps, and hi-lo. This assignment also happened to be part of a competition, with the first place to receive some extra credit. I am happy to report we got first prize, self high five. For this project we implemented the model, view, controller design aspect of Java and included a MySQL database to hold the data.

User Roles

End User

  • Play Games
    • Poker
    • Craps
    • Hi-Lo
  • View Game Leaderboard
  • View Personal Game Statistics


  • View List of
    • Users
    • Games
    • Transactions
  • Delete, Update, or Insert to any Table
  • End User Privileges

Tools and Languages Used


  • NetBeans IDE
  • MySQL Workbench
  • Github


  • Java Server Pages (JSP)
  • JSTL
  • Java Servlets
  • MySQL

Model View Controller (MVC)

  1. A browser sends a request to a servlet either using a GET or POST method.
  2. A servlet receives the request and creates an instance of a database model.
  3. The database model then executes queries and sends any requested data to the servlet.
  4. The servlet prepares a request object with appropriate variables to be used by a view.
  5. The view then sends an html document back to the browser.

Casino App Flow


Database Tables

User Table – Holds information about every user that creates a login.

Game Table – Holds basic information about each game.

Transaction Table – A row is added every time a user plays a game and logs the game played, user who played, amount won or lost. This table is queried to load statistics about the user’s performance.

Casino App db

Login Pages

The first page you see is the login page, you can also choose the existing user login. If username already exist the app will return an error and you will be prompted to create another username.

Login Page

User Login Page










Choose Game Page

After login you will see a page with options to choose a game to play or to view leader-boards.

Game options


User Statistics Page

On the top right of the page user can click on their name and see a page with statistics on their performance.

Stats page for Casino App


Code Snippets


A separate Java Server Page JSP file was created to load the navbar to every page. In the code, I included Java Standard Tag Language JSTL to check if the user is an admin. It then either loads a span with a link to the admin console when appropriate.

JSTL for Admin



When user request a leaderboard the stat servlet checks the action attribute and uses the database model to run a script and return a list of users who have played that game.

SQL Script


Version Control

I used Github for version control on this project and it was the first time using it as a team. That brought on a couple more challenges to the project but the benefits definitely outweighed the setbacks. I can assure you we had a few merge conflicts and took some time to fix them but I feel like it was a great learning experience. Another note, I discovered that NetBeans has cool and easy to use Github controls.


Final Thoughts

I can finally see the full power that Java has to offer. I have now taken 4 different classes on Java alone, more on other programming concepts like databases and ux design, and this was an enlightening experience into how using Java as a backend manager can bring its heavy lifting power to web development.

Let's get in touch.

Reach me at
Or simply fill out this form.