Current location - Education and Training Encyclopedia - Graduation thesis - How to use java as a LAN chat tool (chat room)?
How to use java as a LAN chat tool (chat room)?
Oh, hello, landlord! It is not simple to use Java as a chat room, but it is not difficult to say it is difficult.

Simply put, it is session tracking technology (my personal understanding). To create a chat room, you need to

Tools used: tomcat server (because it is free, others can also be used, hehe).

MyEclipse (a tool for writing Java programs provided by Sun Company, don't say you don't know,

In that case, I will faint.

Page frame design: index.jsp (chat room home page) index_top.jsp (chat room home page).

Usersonline.jsp (online statistics display page) sendMessage.jsp (sending information page)

ShowMessage.jsp (page displaying chat information) registered (page registered by users)

Login (user login page)

Of course, this is the simplest design method. You can design it better.

Page introduction and function:

Index.jsp is mainly the home page of chat rooms. It consists of an upper frame, a middle frame and a lower frame, and the middle is divided into three parts.

There are two frames left and right. In fact, index.jsp is a page composed of five frames.

Top box: put the index_top.jsp page. You can design your own chat room function (such as logo).

The left frame in the middle part: showMessage.jsp shows the chat information.

Right box in the middle: usersonline.jsp (online statistics display page)

Bottom frame: sendMessage.jsp, a jsp page that sends information. Not much to say.

The frame design of the chat room is written in print like this.

Achieve chat:

1. Write a servlet to process information (including verifying whether users log in and chat).

2. After the user sends the information, store the sent information in the application (group chat) (putting it in the conversation is private chat).

3. On the page displaying information, it is ok to get data in the session or application every XX seconds.

More things need to be done after you learn Ajax, which will have different effects. I wish you success! Hmm. How interesting