The PhoneBook Application is a web-based project developed using Servlet and JSP that allows users to manage their personal contacts securely. It employs a simple user authentication system and a session-based mechanism to control access to the application features.
- Registration: New users can register by creating an account.
- Login: Existing users can log in using their email and password.
- Session Management:
- User session is tracked using
session.setAttribute("user", u);. - Unauthorized access is prevented by checking session validity. Users must log in to access features like adding and viewing contacts.
- If a user tries to access restricted features without logging in, they are prompted with a message: "Please login first."
- User session is tracked using
- Add Contact:
- Users can add multiple contacts.
- Each contact is linked to the user via their user ID, which is stored in the
contacttable.
- View Contacts:
- Users can view a list of all their saved contacts.
- The contact list includes options to:
- Edit: Modify existing contact details.
- Delete: Remove unwanted contacts from the list.
- Data Integrity: Each user’s data is stored and managed independently using their unique user ID.
- Users can securely log out of the application, which terminates the session.
The application uses a database named phonebook_db with the following two tables:
-
userTable:- Stores user details such as email, password, and other relevant information.
-
contactTable:- Stores contact details (e.g., name, phone number, email, etc.).
- Includes a
user_idcolumn to associate contacts with the respective user.
-
Registration:
- Users create an account if they don’t already have one.
-
Login:
- Upon successful login, the user’s email is stored in the session.
- Logged-in users can then access contact management features.
-
Add Contact:
- Users can add new contacts, which are saved to the database along with the user ID.
-
View Contacts:
- Displays a list of all the contacts added by the logged-in user.
- Users can choose to edit or delete any contact from the list.
-
Session Validation:
- Before performing any action, the server checks if the user is logged in.
- If the session is invalid, the application redirects the user to the login page with an appropriate message.
-
Logout:
- Ends the session and ensures no unauthorized access.
- Backend: Servlet
- Frontend: JSP
- Database: MySQL
- Server: Apache Tomcat
-
Database Setup:
- Create the database
phonebook_db. - Create the
userandcontacttables as per the schema requirements.
- Create the database
-
Deploy Application:
- Deploy the project on an Apache Tomcat server.
- Ensure database connection settings (e.g., username, password) are correctly configured.
-
Run the Application:
- Open the application in a web browser.
- Register, log in, and start managing your contacts!
- Add functionality to search contacts.
- Implement pagination for viewing a large list of contacts.
- Enable profile management for users (e.g., update password, email).
This project is open-source and available for modification and enhancement.




