FitLife is a web-based smart fitness tracker built using:
-
Java Servlets + JSP
-
JDBC + MySQL
-
Tomcat 9
-
Maven
-
Weka J48 Machine Learning
The application allows users to:
-
Register & log in
-
Add workouts
-
View personal dashboard stats
-
Predict activity type using a decision tree model
-
Maintain data per user
-
Register new accounts
-
Secure login
-
Session handling
-
Logout functionality
-
Add workouts with:
-
Activity type
-
Duration
-
Distance
-
Calories
-
Notes
-
-
View user-specific workouts
-
Stored in MySQL
Shows totals for the logged-in user:
-
Total workouts
-
Total time (minutes)
-
Total calories
User enters:
-
Duration
-
Distance
-
Calories
Model predicts:
-
Running
-
Cycling
-
Walking
-
Gym Workout
Model uses a synthetic 40-record dataset stored in:
src/main/webapp/WEB-INF/dataset/fitness.arff
chinthakas-sem2/
├── pom.xml
├── README.md
├── src/
│ ├── main/
│ │ ├── java/com/fitlife/
│ │ │ ├── config/ DB connection
│ │ │ ├── dao/ DAO classes
│ │ │ ├── model/ Models (User, Workout)
│ │ │ └── servlet/ All Servlets
│ │ ├── webapp/
│ │ │ ├── WEB-INF/
│ │ │ │ ├── views/ JSP screens
│ │ │ │ ├── dataset/ fitness.arff
│ │ │ │ └── web.xml
│ │ │ └── assets/ CSS/JS (if any)
CREATE DATABASE fitlife_db;
USE fitlife_db;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password_hash VARCHAR(255) NOT NULL,
email VARCHAR(100),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE workouts (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
activity_type VARCHAR(50) NOT NULL,
duration_minutes INT NOT NULL,
distance_km DECIMAL(5,2) NOT NULL,
calories_burned INT NOT NULL,
date DATE NOT NULL,
notes VARCHAR(255),
FOREIGN KEY (user_id) REFERENCES users(id)
);
-
Java 17
-
Apache Tomcat 9
-
Maven
-
MySQL
-
Update DB credentials in:
src/main/java/com/fitlife/config/DBConnection.java
-
Build project via IntelliJ Maven tool.
-
Deploy using:
Run → Edit Configurations → Tomcat 9 → Add Deployment → WAR exploded
-
Start Tomcat.
http://localhost:8080/fitlife/login
The model trains on each request using:
src/main/webapp/WEB-INF/dataset/fitness.arff
| Duration | Distance | Calories | Expected |
|---|---|---|---|
| 25 | 4.0 | 260 | Running |
| 55 | 18.0 | 500 | Cycling |
| 50 | 3.5 | 180 | Walking |
| 40 | 0 | 300 | Gym Workout |
Removed:
-
.idea/ -
.git/ -
target/ -
.DS_Store -
__MACOSX/ -
src/main/resources/ -
src/main/java/com/fitlife/ml/(unused ML attempts)
| Layer | Technology |
|---|---|
| Backend | Java Servlets |
| Frontend | JSP + Bootstrap |
| Database | MySQL + JDBC |
| Machine Learning | Weka J48 |
| Server | Apache Tomcat 9 |
| Build Tool | Maven |
This project is:
-
Cleaned
-
Fully functional
-
ML prediction fixed
-
Database stable
-
Ready for academic submission