简体   繁体   中英

java tomcat6 - How to automatically refresh page when a data is added?

first of all let me explain what Im tring to do. Im trying to create a very simple web based chat program. In my development I have 2 pcs using only 1 ip address. The ip address that is being used is the ip address which runs the tomcat6 server. The simple chat is connected to the database. How will I make the web page automatically update when the other pc input data(message) in the database without reloading the page.

Please forgive me if my question might sound idiotic. I have no experience in chat program. Please help.

What are the web technologies using there. If you are using JSF You can use AJAX Push feature from icefaces. you can read more from this link. http://www.icesoft.org/java/projects/ICEfaces/ajax-push.jsf

Technologies you may want to check out:

You can try webSockets. Its a new feature in html5. It allows you to do full duplex communication. Its very simple. You will have to do both client side and server side. For doing the server side you will need tomcat 7.0.32. It contains a new WebSocketServlet. These links may help you..

http://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html

http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/websocket/

http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM