Site icon DataFlair

Java Project – Develop Real-time Chat Application with JSPs and Servlets

Free Java courses with 37 real-time projects - Learn Java

Work on real-time chat application and sharpen your Java skills

The emergence of computer networks and telecommunication technologies allows people to communicate in a new way. Chatting is a method of using technology to bring people and ideas together despite geographical barriers. The technology has been available for years but the acceptance was quite recent.

Objective

This is one of the top projects for beginners. It provides client application which runs on the users’ desktop and server application which runs on any machine on the network. To start chatting our client should get connected to a server where they can do group and private chatting.

The objective of this project is to develop a java chat application. Let’s develop an instant messaging solution to enable users to seamlessly communicate with each other. The project should be very easy to use enabling even a beginner to use it.

Software requirements of the project

Implementation Languages used to develop the project

Database

The total number of tables in the database that was identified to build our system is 6. They are:

Backend

JDBC: JDBC stands for Java Database Connectivity. It is a part of JavaSE (Java Standard Edition). JDBC API uses JDBC drivers to connect with the database.

JSP & Servlets: Java Server Pages (JSP) is a server-side technology that allows development of Web-based applications.

JSP stands for Java Server Page. It is used to create a web application just like Servlet technology. We can think of JSP as an extension to Servlet because it provides more functionality than servlets such as expression language, JSTL, etc.

Frontend

Technology is evolving rapidly!
Stay updated with DataFlair on WhatsApp!!

HTML (HyperText Markup Language)

HTML stands for HyperText Markup Language and it is a standard markup language for creating Web pages. It describes the structure of Web pages.

CSS (Cascading Style Sheets)

CSS is a language that describes the style of an HTML document. It describes how HTML elements should be displayed.

Servlets used in the project

There are 15 servlets used in this project:

acceptFriendRequest.java: This servlet add friend request in the friend request list.

addFriendRequest.java: This servlet adds the friend request to the user in the friend request list when the user sends the friend request.

AddMessage.java: This servlet adds messages to the message box and shows them to the users.

ApplicationSetting.java: This servlet implements the Serializable interface and sets the number of notifications.

Authenticator.java: This servlet is used to authenticating the user when he login to the system. It checks whether the username and password are correct or not.

CloseAccount.java: This servlet deletes the user account from the database and closes the account.

FriendList.java: This servlet shows the friend list of a user. In this list all the friends that are being added by accepting the friend request.

Logout.java: This servlet is used to logout the user from the application.

MessageList.java: This java file shows the message ists to the user in the message box.

ProfileUpdater.java: This servlet is used to update the user profile like username, name, and password.

removeFriend.java: This servlet removes the friend from the friend list.

RemoveFriendRequest.java: This servlet removes the friend request.

UserAvatar.java: This servlet fetches the images from the images folder and shows them on the webpage of the user profile.

userCreator.java: This servlet creates a new user and adds to the database.

usernameAvailabilityVerifier.java: This servlet checks the username availability at the time of registration. If the user tried to enter the already registered username, then there will be an error message shown that asks the user to choose other usernames.

Download Project Source Code

Please download the project: Chat Application Source Code

Running the Project

To run this project you need to install the tomcat9 server and apache derby and Java on your system.

1. Now extract the downloaded project: tmchat.zip

2. Open the cmd and type startnetworkserver command to open the apache derby server:

3. Open another cmd window and type ij command:

4. Now open the tomcat9 server:

5. Now type http://localhost:8080 link on the browser, you will see the login page:

6. You can create an account by registering to the application:

7. Now, Login:

8. After successful login, there is a home page:

9. If you try to register with the existing username, you will the following error:

10. You can log in using google account:

11. You can view your profile:

12. Notifications page:

13. Friend request page:

14. Friend list page:

15. Remove friend page:

16. Update Profile page:

17. New Connections page:

18. Delete Account page:

 

Conclusion

This project is a chat application where you can add your friends and chat with them. You will have to ensure that the tomcat9 server and the apache derby server are connected and they both should be open while running the project. This project covers each and every fundamental aspect of Java language form OOPs concepts to the web development concepts. We hope you have found this project interesting and would have learned a lot from it.

Exit mobile version