简体   繁体   English

java tomcat6-如何在添加数据时自动刷新页面?

[英]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. 我试图创建一个非常简单的基于Web的聊天程序。 In my development I have 2 pcs using only 1 ip address. 在我的开发中,我有2个仅使用1个IP地址的计算机。 The ip address that is being used is the ip address which runs the tomcat6 server. 使用的IP地址是运行tomcat6服务器的IP地址。 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. 当其他PC在数据库中输入数据(消息)而不重新加载页面时,如何使网页自动更新。

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. 如果使用的是JSF,则可以从icefaces使用AJAX推功能。 you can read more from this link. 您可以从此链接中了解更多信息。 http://www.icesoft.org/java/projects/ICEfaces/ajax-push.jsf http://www.icesoft.org/java/projects/ICEfaces/ajax-push.jsf

Technologies you may want to check out: 您可能要检查的技术:

You can try webSockets. 您可以尝试使用webSockets。 Its a new feature in html5. 它是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. 为了执行服务器端,您将需要tomcat 7.0.32。 It contains a new WebSocketServlet. 它包含一个新的WebSocketServlet。 These links may help you.. 这些链接可能会帮助您。

http://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html 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/websocket/

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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