Java, JSP, Servlet, and MySQL web app for checking suspicious government-scheme messages, calculating a trust score, and saving grievances for risky content.
Live app: https://ai-based-digital-trust-fraud-detection.onrender.com
- Rule-based fraud detection
- Trust Score from 0 to 100
SAFE,SUSPICIOUS, andFRAUDlabels- URL checks for trusted
.gov.inand.nic.instyle domains - Message, URL, and
.txtfile analysis - User registration and login
- PBKDF2 password hashing
- Session-based dashboard access
- Basic profile eligibility matching
- Grievance reporting
- MySQL database integration through JDBC
src/java/digitaltrust/ Java servlet logic and shared helpers
web/ JSP frontend
build/web/ Built web app output used by the WAR
dist/DigitalTrustProject1.war Deployable WAR copied by Dockerfile
nbproject/ NetBeans project configuration
Set these in Render or your local Tomcat environment:
DB_URL=jdbc:mysql://your-aiven-host:port/defaultdb?useSSL=true&requireSSL=true&serverTimezone=UTC
DB_USER=your_database_user
DB_PASSWORD=your_database_password
The app also accepts these aliases: AIVEN_DB_URL, AIVEN_DB_USER, AIVEN_DB_PASSWORD, JDBC_DATABASE_URL, JDBC_DATABASE_USERNAME, and JDBC_DATABASE_PASSWORD.
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
age INT NOT NULL,
address VARCHAR(500) NOT NULL,
blood_group VARCHAR(5) NOT NULL,
marital_status VARCHAR(20) NOT NULL,
income DOUBLE NOT NULL
);
CREATE TABLE analysis (
id INT AUTO_INCREMENT PRIMARY KEY,
message VARCHAR(255) NOT NULL,
score INT NOT NULL,
label VARCHAR(20) NOT NULL
);
CREATE TABLE grievances (
id INT AUTO_INCREMENT PRIMARY KEY,
message VARCHAR(1000) NOT NULL,
status VARCHAR(30) NOT NULL
);- User registers and logs in.
- User submits a message, URL, or
.txtfile. - The servlet validates and cleans the input.
FraudAnalyzerapplies weighted risk rules for scam wording, pressure tactics, sensitive-data requests, payment requests, and suspicious URLs.- The app stores the result and shows a trust score.
- Risky content can be submitted as a grievance.
- Install Apache Tomcat and MySQL Connector/J.
- Create the MySQL tables above.
- Set the database environment variables.
- Import the project into NetBeans.
- Build and run on Tomcat.
- Open
http://localhost:8080/DigitalTrustProject1/.
The project deploys on Render using the checked-in WAR:
FROM tomcat:9.0
COPY dist/DigitalTrustProject1.war /usr/local/tomcat/webapps/After changing Java or JSP files, rebuild build/web and dist/DigitalTrustProject1.war, then push to the branch Render deploys from.
- Do not commit database credentials.
- Configure production credentials only through Render environment variables.
- Previously committed credentials should be rotated.
- New passwords are stored with PBKDF2 hashes.
- Existing plain-text user passwords are upgraded to hashed passwords after a successful login.
- User-facing errors avoid printing database exception details.