摘要
C/S模式下,客户端之间的信息交互通过Socket编程或者消息传递中间件很容易实现,而B/S模式下,作为客户端的浏览器之间的信息交互却很难实现,因为浏览器客户端对信息的改变很容易提交给服务器端,反过来,服务器端的信息的改变却很难及时地通知每个客户端,只能通过客户端重新发出HTTP请求。传统的方法是每个客户端的网页每隔一段时间就刷新一次,这势必会造成整个页面的不断刷新和重载,从而浪费时间和宽带。文中利用Ajax与服务器端交互异步的特点,结合Jsp/Servlet的强大功能,实现web页面无刷新快速更新数据方法,达到客户端与服务器端尽量保持数据同步,客户端之间通过web服务器实现了信息的交互,并且在用户体验上也得到了优化。实验结果表明,该方法具有一定的实用性。
The communication among the clients can be easily realized using the Socket programming or middleware of message queue in the mode of the client/server. But it is difficult to be realized in the mode of browser/server,since the changing of clients which is browser can easily be sent to server while the changing of server could not be sent to the clients. The clients can only be modified by sending the request of HTTP again in the mode of browser/server. Traditional method is to refresh the client at regular intervals. It must lead to continuously refreshing and loading. It is a waste of time and bandwidth. In this paper,a novel method of combining the characteristic of asynchronous communication of Ajax and the strong function of Jsp/Servlet is proposed. It can achieve the high quality of synchronization between the clients and server,and realize the communication among clients by web server. The experiments reveal its applicability.
出处
《计算机技术与发展》
2007年第10期92-94,98,共4页
Computer Technology and Development
基金
安徽省自然科学基金(050420208)