.atitit.web 推送实现解决方式集合(3)----dwr3 Reverse Ajax

.atitit.web 推送实现解决方式集合(3)----dwr3 Reverse Ajax

1. 原理实现 1

2. Page  添加配置。添加回调函数dwr.engine.setActiveReverseAjax(true); 1

3. Web.xml添加配置 1

4. Java代码(page法,简单) 2

5. 推荐实现方式 attribute法。。 2

6. 參考::: 2

1. 原理实现

ScriptSession ::简单的一个page url管理一个scriptsession,这个dept兰。

attribute法::: 一个page能够多个sess,这个推荐。

2. Page  添加配置。添加回调函数dwr.engine.setActiveReverseAjax(true);

作者:: 老哇的爪子 Attilax 艾龙。  EMAIL:1466519819@qq.com

转载请注明来源: http://blog.csdn.net/attilax

3. Web.xml添加配置

   <init-param>

    <param-name>activeReverseAjaxEnabled</param-name>

    <param-value>true</param-value>

  </init-param>

  <init-param>

  <param-name>org.directwebremoting.extend.ServerLoadMonitor</param-name>

  <param-value>org.directwebremoting.impl.PollingServerLoadMonitor</param-value>

</init-param>

 <!-- timer time  -->

<init-param>

  <param-name>disconnectedTime</param-name>

  <param-value>1000</param-value>

</init-param>

4. Java代码(page法。简单)

public static void pushJs(String js_str) {

js_str=js_str.replace("/elfinder-2.0-rc1/php/../../", "");

// attilax 老哇的爪子 1_u_8 o0c

Collection<ScriptSession> sesses = ServerContextFactory.get().getScriptSessionsByPage("/vod/elemt/elemt_edit.jsp");

// Util util=new Util(sesses);

for (ScriptSession scriptSession : sesses) {

String script = js_str;// "recvFilepath('aaaa');";

scriptSession.addScript(new ScriptBuffer(script));

}

}

//e

 

5. 推荐实现方式 attribute法。。

參考官方文档。。

6. 參考:::

DwrReverse Ajax初步技术实现 它山之石,能够攻玉 博客频道 - CSDN.NET.htm

dwr 后台推送技术 - is_zhoufeng的专栏 博客频道 - CSDN.NET

dwr3实现消息精确推送具体步骤 少年阿宾 - BlogJava

DWR Reverse Ajax功能实践的要点 我爱佳娃 - BlogJava

Dwr website (detail zeush)  recomm

我要啦免费统计
原文地址:https://www.cnblogs.com/blfshiye/p/5085221.html