This is a web application developed using pure Java technology stack, implementing user login verification and personalized welcome page functionality. Here is the public link: https://54.221.107.40/webapp/login and demo video link: https://youtu.be/CzeJUOHXt2c
- Java 11
- Maven - Project Management
- Servlet 4.0 - Web Services
- JSP 2.3 - Page Templates
- JSTL 1.2 - Tag Library
- MySQL 8.0+ - Database
- Tomcat 9.0 - Application Server
- β User Login Verification
- β User Registration System
- β Secure Password Hashing (BCrypt)
- β Password Strength Validation
- β Database User Management
- β Session Management
- β Personalized Welcome Page
- β Responsive UI Design
- β Error Handling
- β User Statistics
- Java 11 or higher
- Maven 3.6+
- MySQL 8.0+
- Tomcat 9.0+
- Start MySQL service
- Execute database initialization script:
mysql -u root -p < database_init.sql
- Modify database connection configuration (if needed):
- File:
src/main/java/com/example/webapp/util/DatabaseUtil.java - Modify database URL, username and password
- File:
# Clean and compile project
mvn clean compile
# Package as WAR file
mvn clean package- Copy the generated
target/webapp.warfile to Tomcat'swebappsdirectory - Start Tomcat server
- Access:
http://localhost:8080/webapp
- Access Registration Page:
http://localhost:8080/webapp/register - Fill Registration Form:
- Username (unique)
- Email address
- Full name
- Password (must contain uppercase, lowercase, and numbers)
- Confirm password
- Submit Registration: System will hash password securely and create account
| Username | Password | Description |
|---|---|---|
| hostedftp | Money123456789! | Test1 |
| admin | Admin111111111@ | Test2 |
| user1 | Password123456# | Test3 (demo) |
Note: All test accounts need to be registered first using the registration form.
- Homepage:
http://localhost:8080/webapp/ - Registration Page:
http://localhost:8080/webapp/register - Login Page:
http://localhost:8080/webapp/login - Welcome Page:
http://localhost:8080/webapp/welcome - Test Servlet:
http://localhost:8080/webapp/hello
webapp/
βββ src/main/java/com/example/webapp/
β βββ model/
β β βββ User.java # User Data Model
β βββ dao/
β β βββ UserDAO.java # User Data Access Object
β βββ util/
β β βββ DatabaseUtil.java # Database Connection Utility
β β βββ PasswordUtil.java # Password Security Utility (BCrypt)
β βββ servlet/
β β βββ LoginServlet.java # Login Processing
β β βββ RegisterServlet.java # User Registration
β β βββ WelcomeServlet.java # Welcome Page
β β βββ LogoutServlet.java # Logout Processing
β βββ HelloServlet.java # Example Servlet
βββ src/main/webapp/
β βββ WEB-INF/
β β βββ web.xml # Web Configuration
β βββ index.jsp # Homepage
β βββ login.jsp # Login Page
β βββ register.jsp # Registration Page
β βββ welcome.jsp # Welcome Page
β βββ error.jsp # Error Page
βββ database_init.sql # Database Initialization Script
βββ pom.xml # Maven Configuration
βββ README.md # Project Documentation
Modify the following configuration in DatabaseUtil.java:
private static final String DB_URL = "jdbc:mysql://localhost:3306/webapp_db?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true";
private static final String DB_USERNAME = "root";
private static final String DB_PASSWORD = "root"; // Change to your MySQL passwordThe application uses BCrypt for password hashing with the following configuration in PasswordUtil.java:
private static final int BCRYPT_ROUNDS = 12; // BCrypt strength levelPassword Requirements:
- Minimum 6 characters
- Must contain uppercase letters
- Must contain lowercase letters
- Must contain numbers
Configure session timeout in web.xml:
<session-config>
<session-timeout>30</session-timeout> <!-- 30 minutes -->
</session-config>-
Database Connection Failed
- Check if MySQL service is running
- Verify database connection configuration
- Confirm database and tables are created
-
Compilation Errors
- Check if Java version is 11+
- Run
mvn clean compileto recompile
-
Deployment Failed
- Check Tomcat service status
- Confirm WAR file integrity
- Check Tomcat logs
- Application Logs: Check console output
- Tomcat Logs:
$TOMCAT_HOME/logs/ - MySQL Logs: Check MySQL error logs
Password Security:
- All passwords are hashed using BCrypt algorithm
- BCrypt rounds set to 12 for strong security
- Passwords are never stored in plain text
- Password strength validation on registration
User Registration:
- Username uniqueness validation
- Email format validation
- Password confirmation matching
- Secure password hashing before database storage
- Create new classes in appropriate packages
- Update
web.xmlto configure new Servlet mappings - Create corresponding JSP pages
- Test feature completeness
- Modify
Usermodel class - Update SQL statements in
UserDAO - Execute database migration scripts
- Password Handling: Always use
PasswordUtilfor password operations - Input Validation: Validate all user inputs on both client and server side
- SQL Injection: Use PreparedStatement for all database queries
- Session Management: Implement proper session timeout and invalidation
This project is for learning and demonstration purposes only.
Welcome to submit Issues and Pull Requests to improve this project!
This project now includes comprehensive security features:
- β Password Hashing: BCrypt algorithm with 12 rounds
- β Password Strength Validation: Enforces strong password requirements
- β SQL Injection Protection: All queries use PreparedStatement
- β Input Validation: Server-side validation for all user inputs
- β Session Security: Proper session management and timeout
- β User Registration: Secure account creation with validation
Note: This is a demonstration project with security features implemented. For production use, consider additional security measures such as HTTPS, rate limiting, and comprehensive logging.