`
jsczxy2
  • 浏览: 1270824 次
  • 性别: Icon_minigender_1
  • 来自: 常州
文章分类
社区版块
存档分类
最新评论

基于DWR的点对点聊天实现 server---client

阅读更多

本文转自:http://htj1231825.iteye.com/blog/2206526

RemoteMessageServer 客服类 

Java代码  收藏代码
  1. package com.gw.medical.hospital.utils.dwr;  
  2.   
  3. import java.util.Iterator;  
  4. import java.util.Map;  
  5.   
  6. import javax.servlet.http.HttpSession;  
  7.   
  8. import org.directwebremoting.ScriptBuffer;  
  9. import org.directwebremoting.ScriptSession;  
  10. import org.directwebremoting.WebContextFactory;  
  11. import org.directwebremoting.annotations.RemoteMethod;  
  12. import org.directwebremoting.annotations.RemoteProxy;  
  13.   
  14. @RemoteProxy(name = "RemoteMessageServer")  
  15. public class RemoteMessageServer {  
  16.   
  17.     /** 
  18.      *服务端初始化 
  19.      */  
  20.     @RemoteMethod  
  21.     public void onPageLoad() {  
  22.         getHttpSession().setAttribute("userInfo""CustomerService1"); // 测试用,存入模拟userInfo信息  
  23.         RemoteMessageConstant.getServerList().put(getScriptSession().getId(), getScriptSession());// 存储当前客服,到在线客服列表  
  24.     }  
  25.   
  26.     /** 
  27.      * 服务端发送信息 
  28.      *  
  29.      * @param message 
  30.      */  
  31.     @RemoteMethod  
  32.     public void addMessage(final String message) {  
  33.         HttpSession httpsession = getHttpSession();// 获取session  
  34.         String clientName = httpsession.getAttribute("clientName") == null ? "" : httpsession.getAttribute("clientName").toString();// 当前客户端ID  
  35.         ScriptSession session = RemoteMessageConstant.getMapList().get(clientName);// 根据clientName获取scriptSession;  
  36.         if (session != null) {  
  37.             // 发送消息  
  38.             String serverMessage=getHttpSession().getAttribute("userInfo").toString();  
  39.             serverMessage=serverMessage+":"+message;  
  40.             sendMessage(session,"receiveMessages",serverMessage);  
  41.         }  
  42.     }  
  43.   
  44.     /** 
  45.      * 选择下一个客户端 
  46.      *  
  47.      * @return boolean 
  48.      */  
  49.     @RemoteMethod  
  50.     public String selectClient() {  
  51.         addMessage("本次会话结束!感谢您的咨询!");  
  52.         // 销毁上一位客户  
  53.         removeClient();  
  54.         ScriptSession sessionServer = getScriptSession();// 获取客服ScriptSsession  
  55.         HttpSession httpsession = getHttpSession();// 获取session  
  56.         Map<String, ScriptSession> userMap = RemoteMessageConstant.getMapList();// 用户在线MAP  
  57.         Iterator<String> iterator = userMap.keySet().iterator();  
  58.         String clientName = "";// 获取客户端列表中的,clientName;  
  59.   
  60.         while (iterator.hasNext()) {  
  61.             // 判断当前用户是否有客服接入,如未接入,接入该客户  
  62.             String tempName = iterator.next();  
  63.             if (RemoteMessageConstant.getMappingList().get(tempName) == null) {  
  64.                 clientName = tempName;  
  65.                 break;  
  66.             }  
  67.         }  
  68.         ScriptSession session = userMap.get(clientName);// 根据clientName获取scriptSession;  
  69.         // 更改客户端的服务ID  
  70.         if (session != null) {  
  71.             // 调用页面JS  
  72.             sendMessage(session, "setServerName", httpsession.getAttribute("userInfo").toString());  
  73.             httpsession.setAttribute("clientName", clientName);// 存储当前客户ID  
  74.             RemoteMessageConstant.getMappingList().put(session.getId(), sessionServer);// 存储对应关系,到关系MAP  
  75.             return RemoteMessageConstant.getUserNamList().get(clientName);  
  76.         }  
  77.   
  78.         return "";  
  79.     }  
  80.   
  81.     /** 
  82.      * 销毁当前,服务端对应的客户端信息 
  83.      */  
  84.     public void removeClient() {  
  85.         HttpSession httpSession = getHttpSession();// 获取httpsession  
  86.         String clientName = httpSession.getAttribute("clientName") == null ? "" : httpSession.getAttribute("clientName").toString();  
  87.         RemoteMessageConstant.getMappingList().remove(clientName);// 从关系Map中,删除对应关系。  
  88.         RemoteMessageConstant.getMapList().remove(clientName);// 从用户Map中,删除该用户;  
  89.         RemoteMessageConstant.getUserNamList().remove(clientName);//从用户名列表 删除该用户名  
  90.         httpSession.removeAttribute("clientName");// 删除当前服务端的,客户ID  
  91.     }  
  92.   
  93.     /** 
  94.      * 调用页面JS 
  95.      * @param scriptSession,jsName:JS方法名,message:发送的信息 
  96.      */  
  97.     public void sendMessage(ScriptSession scriptSession, String jsName, String message) {  
  98.         ScriptBuffer script = new ScriptBuffer();  
  99.         script.appendCall(jsName, message);  
  100.         scriptSession.addScript(script);  
  101.     }  
  102.   
  103.     /** 
  104.      * get set 
  105.      */  
  106.   
  107.     public ScriptSession getScriptSession() {  
  108.   
  109.         return WebContextFactory.get().getScriptSession();  
  110.     }  
  111.   
  112.     public HttpSession getHttpSession() {  
  113.   
  114.         return WebContextFactory.get().getSession();  
  115.     }  
  116.   
  117. }  



RemoteMessageClient  客户端 

Java代码  收藏代码
  1. package com.gw.medical.hospital.utils.dwr;  
  2.   
  3. import java.util.Collection;  
  4. import java.util.Iterator;  
  5.   
  6. import javax.servlet.ServletException;  
  7. import javax.servlet.http.HttpSession;  
  8.   
  9. import org.directwebremoting.Browser;  
  10. import org.directwebremoting.ScriptBuffer;  
  11. import org.directwebremoting.ScriptSession;  
  12. import org.directwebremoting.ScriptSessionFilter;  
  13. import org.directwebremoting.WebContextFactory;  
  14. import org.directwebremoting.annotations.RemoteMethod;  
  15. import org.directwebremoting.annotations.RemoteProxy;  
  16.   
  17. @RemoteProxy(name = "RemoteMessageClient")  
  18. public class RemoteMessageClient {  
  19.   
  20.     /** 
  21.      * 客户端初始化 
  22.      */  
  23.     @RemoteMethod  
  24.     public void onPageLoadClient() {  
  25.         ScriptSession scriptSession = getScriptSession();  
  26.         HttpSession httpSession = getHttpSession();  
  27.         String clientName = scriptSession.getId();// 获取seciptSessionID作为clientName  
  28.         httpSession.setAttribute("clientName", clientName);  
  29.         RemoteMessageConstant.getMapList().put(clientName, scriptSession);// 存储用户信息到在线用户列表  
  30.         RemoteMessageConstant.getUserNamList().put(clientName, "游客");  
  31.         // 服务器显示在线用户列表;  
  32.         showOnlinClient();  
  33.         DwrScriptSessionManagerUtil dssm = new DwrScriptSessionManagerUtil();  
  34.         try {  
  35.             dssm.init();  
  36.         } catch (ServletException e) {  
  37.             e.printStackTrace();  
  38.         }  
  39.     }  
  40.   
  41.     /** 
  42.      * 客户端发送信息 
  43.      *  
  44.      * @param message 
  45.      */  
  46.     @RemoteMethod  
  47.     public void addMessageClient(String message) {  
  48.         HttpSession httpSession = getHttpSession();  
  49.         String clientName = httpSession.getAttribute("clientName") == null ? "" : httpSession.getAttribute("clientName").toString();// 获取当前登录客户端ID,在用户列表中查找相应客服  
  50.         String autoMessage = message;// 发送的内容  
  51.         ScriptSession scriptSession = RemoteMessageConstant.getMappingList().get(clientName);// 从对应Map中获取,当前客户端对应的服务端ScriptSession  
  52.   
  53.         if (scriptSession != null) {  
  54.             String clientMessage=RemoteMessageConstant.getUserNamList().get(clientName);  
  55.             clientMessage+=":"+autoMessage;  
  56.             sendMessage(scriptSession,"receiveMessages",clientMessage);  
  57.         }  
  58.     }  
  59.   
  60.     /** 
  61.      * 更改服务端在线用户列表 
  62.      */  
  63.     public void showOnlinClient() {  
  64.         Browser.withAllSessionsFiltered(new ScriptSessionFilter() {  
  65.             // 筛选scriptSession的用户,发送目标ID,是否在scriptSession中存在  
  66.             public boolean match(ScriptSession session) {  
  67.                 if (RemoteMessageConstant.getServerList().get(session.getId()) != null) {  
  68.                     return true;  
  69.                 } else {  
  70.                     return false;  
  71.                 }  
  72.             }  
  73.         }, new Runnable() {  
  74.             private ScriptBuffer script = new ScriptBuffer();  
  75.   
  76.             public void run() {  
  77.                 // 输出内容到页面  
  78.                 Iterator<String> it = RemoteMessageConstant.getMapList().keySet().iterator();  
  79.                 String autoMessage = new String();  
  80.                 while (it.hasNext()) {  
  81.                     String key = it.next().toString();  
  82.                     // 如果没有被分配客服,显示在等待列表中  
  83.                     if (RemoteMessageConstant.getMappingList().get(key) == null) {  
  84.   
  85.                         autoMessage += RemoteMessageConstant.getUserNamList().get(key) + ";";  
  86.                     }  
  87.                 }  
  88.                 script.appendCall("showOnlinClient", autoMessage);  
  89.                 Collection<ScriptSession> sessions = Browser.getTargetSessions();  
  90.                 for (ScriptSession scriptSession : sessions) {  
  91.                     scriptSession.addScript(script);  
  92.                 }  
  93.             }  
  94.         });  
  95.     }  
  96.   
  97.   
  98.     /** 
  99.      * get set 
  100.      */  
  101.     /** 
  102.      * 调用页面JS 
  103.      *  
  104.      * @param scriptSession 
  105.      *            ,jsName:JS方法名,message:发送的信息 
  106.      */  
  107.     public void sendMessage(ScriptSession scriptSession, String jsName, String message) {  
  108.         ScriptBuffer script = new ScriptBuffer();  
  109.         script.appendCall(jsName, message);  
  110.         scriptSession.addScript(script);  
  111.     }  
  112.   
  113.     public ScriptSession getScriptSession() {  
  114.   
  115.         return WebContextFactory.get().getScriptSession();  
  116.     }  
  117.   
  118.     public HttpSession getHttpSession() {  
  119.   
  120.         return WebContextFactory.get().getSession();  
  121.     }  
  122. }  




DwrScriptSessionManagerUtil 监听 

Java代码  收藏代码
  1. package com.gw.medical.hospital.utils.dwr;  
  2.   
  3. import javax.servlet.ServletException;  
  4.   
  5. import org.directwebremoting.Container;  
  6. import org.directwebremoting.ScriptBuffer;  
  7. import org.directwebremoting.ScriptSession;  
  8. import org.directwebremoting.ServerContextFactory;  
  9. import org.directwebremoting.event.ScriptSessionEvent;  
  10. import org.directwebremoting.event.ScriptSessionListener;  
  11. import org.directwebremoting.extend.ScriptSessionManager;  
  12. import org.directwebremoting.servlet.DwrServlet;  
  13.   
  14. public class DwrScriptSessionManagerUtil extends DwrServlet {  
  15.   
  16.     private static final long serialVersionUID = -7504612622407420071L;  
  17.   
  18.     public void init() throws ServletException {  
  19.         Container container = ServerContextFactory.get().getContainer();  
  20.         ScriptSessionManager manager = container.getBean(ScriptSessionManager.class);  
  21.         ScriptSessionListener listener = new ScriptSessionListener() {  
  22.             public void sessionCreated(ScriptSessionEvent ev) {  
  23.   
  24.             }  
  25.   
  26.             public void sessionDestroyed(ScriptSessionEvent ev) {  
  27.                 if (RemoteMessageConstant.getMappingList().get(ev.getSession().getId()) != null) {  
  28.                     ScriptSession scriptSession = RemoteMessageConstant.getMappingList().get(ev.getSession().getId());  
  29.                     sendMessage(scriptSession,"receiveMessages","客户端已关闭!");  
  30.                 }  
  31.                 // 删除该用户的列表信息  
  32.                 RemoteMessageConstant.getMapList().remove(ev.getSession().getId());  
  33.                 RemoteMessageConstant.getMappingList().remove(ev.getSession().getId());  
  34.                 RemoteMessageConstant.getServerList().remove(ev.getSession().getId());  
  35.                 RemoteMessageConstant.getUserNamList().remove(ev.getSession().getId());  
  36.                 // 更新服务端在线列表  
  37.                 RemoteMessageClient rc = new RemoteMessageClient();  
  38.                 rc.showOnlinClient();  
  39.             }  
  40.         };  
  41.         manager.addScriptSessionListener(listener);  
  42.     }  
  43.     /** 
  44.      * 调用页面JS 
  45.      * @param scriptSession,jsName:JS方法名,message:发送的信息 
  46.      */  
  47.     public void sendMessage(ScriptSession scriptSession, String jsName, String message) {  
  48.         ScriptBuffer script = new ScriptBuffer();  
  49.         script.appendCall(jsName, message);  
  50.         scriptSession.addScript(script);  
  51.     }  
  52. }  



RemoteMessageConstant 静态常量 

Java代码  收藏代码
  1. package com.gw.medical.hospital.utils.dwr;  
  2.   
  3. import java.util.HashMap;  
  4. import java.util.Map;  
  5.   
  6. import org.directwebremoting.ScriptSession;  
  7.   
  8. public class RemoteMessageConstant {  
  9.     private static Map<String, ScriptSession> mapList = new HashMap<String, ScriptSession>();// 在线用户,Key为在线用户,Value为对应的客服,如果为空表示当前无客服接入;用户等待列表  
  10.     private static Map<String, String> userNamList = new HashMap<String, String>();// 在线用户名称  
  11.     private static Map<String, ScriptSession> mappingList = new HashMap<String, ScriptSession>();// 对应关系Map  
  12.     private static Map<String, ScriptSession> serverList = new HashMap<String, ScriptSession>();// 服务端在线列表  
  13.   
  14.     /** 
  15.      * get set 
  16.      */  
  17.     public static Map<String, ScriptSession> getMapList() {  
  18.         return mapList;  
  19.     }  
  20.   
  21.     public static void setMapList(Map<String, ScriptSession> mapList) {  
  22.         RemoteMessageConstant.mapList = mapList;  
  23.     }  
  24.   
  25.     public static Map<String, ScriptSession> getMappingList() {  
  26.         return mappingList;  
  27.     }  
  28.   
  29.     public static void setMappingList(Map<String, ScriptSession> mappingList) {  
  30.         RemoteMessageConstant.mappingList = mappingList;  
  31.     }  
  32.   
  33.     public static Map<String, ScriptSession> getServerList() {  
  34.         return serverList;  
  35.     }  
  36.   
  37.     public static void setServerList(Map<String, ScriptSession> serverList) {  
  38.         RemoteMessageConstant.serverList = serverList;  
  39.     }  
  40.   
  41.     public static Map<String, String> getUserNamList() {  
  42.         return userNamList;  
  43.     }  
  44.   
  45.     public static void setUserNamList(Map<String, String> userNamList) {  
  46.         RemoteMessageConstant.userNamList = userNamList;  
  47.     }  
  48.   
  49.   
  50. }  



serverMessage.jsp  客服页 

Java代码  收藏代码
  1. <%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>  
  2. <!DOCTYPE html >  
  3. <html>  
  4. <head>  
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
  6. <title>Server</title>  
  7. <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/themes/default/easyui.css">  
  8. <script type="text/javascript" src="<%=request.getContextPath()%>/dwr/engine.js"> </script>  
  9. <script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>  
  10. <script type="text/javascript" src="<%=request.getContextPath()%>/dwr/interface/RemoteMessageServer.js"> </script>  
  11. <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"> </script>  
  12. <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.easyui.min.js"> </script>  
  13. <script type="text/javascript">  
  14.     $(function(){  
  15.         dwr.engine.setActiveReverseAjax(true);  
  16.         dwr.engine.setNotifyServerOnPageUnload(true);  
  17.         onPageLoad();  
  18.         //对话框初始化  
  19.         $("#messageDialog").dialog({  
  20.             title:'对话框',  
  21.             width:600,  
  22.             height:550,  
  23.             closed:false,  
  24.             cache:false  
  25.         });  
  26.     });  
  27.       function sendMessage(message) {  
  28.             // 通过代理调用后台的addMessage方法发送消息  
  29.             RemoteMessageServer.addMessage(message);  
  30.     }  
  31.     // 前台接受消息的方法,由后台调用   
  32.       function receiveMessages(messages) {  
  33.             var p=$("  
  34. ");  
  35.             $(p).append(messages);  
  36.             $("#messageContent").append(p);  
  37.       }  
  38.         
  39.       //读取name值作为推送的唯一标示  
  40.       function onPageLoad(){  
  41.         // 通过代理,传入区别本页面的唯一标识符  
  42.         RemoteMessageServer.onPageLoad();  
  43.        }  
  44.        function selectClient(){  
  45.            RemoteMessageServer.selectClient({  
  46.                callback:function(clientName) {   
  47.                   if(clientName=="")  
  48.                       alert("选择失败!")  
  49.                   else  
  50.                      $("#messageContent").append("客户:"+clientName+",已成功接入!"+"<br/>");  
  51.                      $("#messageDialog").dialog({title:'客户:'+clientName});  
  52.                }  
  53.                  
  54.            });  
  55.        }  
  56.        function showOnlinClient(str){  
  57.            $(".onlineUser").html(str);  
  58.        }  
  59.         /** 
  60.      * 页面JS 
  61.      */  
  62.      function showIcon(){  
  63.         if($("#icondiv").css("display")=="none"){  
  64.             $("#icondiv").css("display","block");  
  65.         }else{  
  66.             $("#icondiv").css("display","none");  
  67.         }  
  68.      }  
  69.      function addIcon(str){  
  70.          var img=$('<img src="<%=request.getContextPath()%>/images/dwr/'+str+'.gif"/>');  
  71.          $("#messageTextArea").append($(img));  
  72.      }  
  73.      function jsSendMessage(){  
  74.          var message=$("#messageTextArea").html();  
  75.          $("#messageContent").append("我:"+message+"<br/>");  
  76.          $("#messageTextArea").html("");  
  77.          this.sendMessage(message);  
  78.      }  
  79.           
  80. </script>  
  81. <style type="text/css">  
  82.     #icondiv ul{  
  83.         width: 400px;   
  84.         height: 130px;  
  85.         overflow: auto;  
  86.         border: 1px solid black;  
  87.     }  
  88.     #icondiv ul li{  
  89.         float: left;  
  90.         width: 45px;  
  91.         list-style: none;  
  92.           
  93.     }  
  94.     #icondiv ul li img{  
  95.         width: 40px;  
  96.         height: 40px;  
  97.     }  
  98. </style>  
  99. </head>  
  100. <body>  
  101.     [align=center;]  
  102.             [url=javascript:void(0)]发送[/url]  
  103.             [/align]  
  104.         </div>  
  105.     </div>  
  106.     <div><input type="button" onclick="selectClient()" value="selectClient"/></div>  
  107.     [align=center;]  
  108.             [url=javascript:void(0)]发送[/url]  
  109.             [/align]  
  110.         </div>  
  111.     </div>  
  112. </body>  
  113. </html>  
分享到:
评论

相关推荐

    基于DWR推送的web聊天系统

    【基于DWR推送的Web聊天系统】是一种利用Direct Web Remoting (DWR) 技术构建的实时交互式在线聊天应用。DWR是一款开源的Java库,它允许JavaScript在浏览器端与服务器端的Java对象进行直接通信,实现了AJAX(异步...

    基于dwr推送技术的聊天室

    在这个"基于DWR推送技术的聊天室"项目中,我们将探讨如何利用DWR实现一个实时的在线聊天平台。 首先,让我们理解DWR的工作原理。DWR通过建立一个HTTP长连接,保持客户端与服务器端的持续通信。当服务器端有新的消息...

    dwr实现的网页即时聊天

    在这个"使用dwr实现的网页即时聊天"项目中,我们将深入探讨如何利用DWR的服务器推技术来创建一个实时的群聊系统。 1. **DWR框架**: DWR简化了JavaScript与Java之间的通信,通过在浏览器端提供动态生成的JavaScript ...

    基于DWR的AJAX技术研究与实现.pdf

    "基于DWR的AJAX技术研究与实现" 本文主要研究了基于DWR的AJAX技术的实现机制和应用。DWR是一个基于Java的开源框架,允许将服务器端的对象上的方法直接暴露给AJAX请求,从而可以直接调用服务器上的Servlet并获取处理...

    基于DWR的实时web聊天系统

    综上所述,基于DWR的实时Web聊天系统利用了DWR的核心特性,实现了高效的前后端通信,提供了流畅的用户体验。通过合理的架构设计和优化,这样的系统能够满足大规模在线聊天的需求,同时也为其他实时交互应用提供了...

    java+dwr框架实现聊天室

    &lt;servlet-name&gt;dwr-invoker&lt;/servlet-name&gt; &lt;servlet-class&gt;org.directwebremoting.servlet.DwrServlet&lt;/servlet-class&gt; &lt;init-param&gt; 调试DWR,发布系统时应将其设为false &lt;param-name&gt;debug&lt;/param-name&gt; ...

    jsp DWR框架推模式实现的聊天室

    在本项目"jsp DWR框架推模式实现的聊天室"中,我们将探讨如何利用DWR的推送(Push)模式来构建一个实时的在线聊天应用。** 首先,我们需要了解DWR的基本工作原理。DWR通过在浏览器和服务器之间建立一个持久连接,...

    采用dwr技术实现的聊天室

    **DWR(Direct Web Remoting)技术是一种在Web应用程序中实现AJAX(Asynchronous JavaScript and XML)通信的方法,它允许JavaScript直接调用Java方法,从而实现在不刷新整个页面的情况下更新部分网页内容。...

    dwr反转实现及时聊天

    这样,你就创建了一个基于DWR的实时聊天系统,前端JavaScript与后端Java之间可以通过DWR进行高效的通信,实现了即时聊天功能。 总结来说,DWR反转实现实时聊天的关键在于正确配置`dwr.xml`和`web.xml`,以及编写...

    spring3+dwr3实现聊天功能

    Spring提供稳定的服务层支持,而DWR则负责实现高效的客户端和服务器通信,尤其是Server Push特性,使得聊天功能更加实时和流畅。通过合理的架构设计和安全控制,这样的聊天系统能够为用户提供优秀的交互体验。

    基于DWR的AJAX技术研究与实现 (1).pdf

    "基于DWR的AJAX技术研究与实现" DWR(Direct Web Remoting)是一种基于Java的AJAX框架,它使得Java开发者可以轻松地在Web开发中使用AJAX技术。DWR的出现解决了Java开发者在使用AJAX技术时遇到的问题,使得Java...

    DWR在线即时聊天系统,实现了对指定用户发送消息,和即时显示功能

    DWR(Direct Web Remoting)是一种Java技术,用于在Web应用...通过以上分析,我们可以看出DWR在这个在线即时聊天系统中的关键作用,它不仅简化了前后端的交互,还实现了高效的实时通信,使得私聊功能得以流畅地运行。

    DWR 在线即时聊天系统,实现了对指定用户发送消息,和即时显示功能.rar

    DWR 在线即时聊天系统,实现了对指定用户发送消息,和即时显示功能.rarDWR 在线即时聊天系统,实现了对指定用户发送消息,和即时显示功能.rarDWR 在线即时聊天系统,实现了对指定用户发送消息,和即时显示功能.rarDWR 在线...

    基于DWR的webIM系统

    基于DWR的webIM系统,利用反向ajax(comet)技术和dwr框架实现了聊天室和点对点聊天的功能,项目运行起来后打开页面,输入用户名即可登录,登录后用户会显示在左侧用户框中,若想与用户私聊,在用户框中点击用户,在...

    dwr-下拉菜单实现

    ### dwr-下拉菜单实现 #### 知识点概览 本文将详细介绍如何使用DWR(Direct Web Remoting)框架结合JavaScript与HTML技术来实现动态下拉菜单功能。主要涉及的技术点包括:DWR的基本原理、如何通过DWR调用服务器端...

    DWR3实现的在线聊天系统

    总结起来,DWR3的在线聊天系统是基于Java和Ajax技术的实时通信解决方案,通过`ScriptSessionListener` 和 `ScriptSessionFilter`接口,实现了会话管理和安全性控制,提供了丰富的交互体验。而具体的实现细节,包括...

    基于dwr3实现的在线客服系统

    **基于DWR3实现的在线客服系统** DWR (Direct Web Remoting) 是一个开源的Java库,允许JavaScript和服务器端的Java代码进行实时交互,实现了浏览器与服务器之间的双向通信,使得Web应用能够具备类似桌面应用的用户...

    这是一个用Extjs写的前端在线聊天模块,基于DWR实现!

    在这个在线聊天模块中,“基于DWR实现”意味着服务器端的业务逻辑和数据处理通过DWR来完成。当用户发送消息时,DWR将这些请求直接转发到后台,处理完成后,结果会实时反馈回前端,无需刷新页面。这种方式极大地提高...

    web聊天,私聊,群聊。dwr实现。无数据库

    综上所述,这个项目展示了一个基于DWR的实时聊天系统实现,它利用了J2EE的稳定性、DWR的双向通信能力、Servlet的请求处理功能以及JavaScript的客户端交互性,创建了一个无需数据库支持的高效聊天应用。用户可以进行...

    Dwr 推例子 反转 ajax dwr dwr推群聊 dwr聊天系统源码 聊天系统 广播系统

    总之,这个基于DWR的聊天系统实例展示了DWR在创建实时Web应用中的强大功能,包括反转Ajax、Push技术、数据流处理、加密和持久化等。通过学习这个项目,开发者可以进一步提升自己在构建高效、安全的Ajax应用方面的...

Global site tag (gtag.js) - Google Analytics