標籤:style blog http color io ar java for sp
.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:[email protected]
轉載請註明來源: 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. 參考:::
Dwr的Reverse Ajax初步技術實現 - 它山之石,可以攻玉 - 部落格頻道 - CSDN.NET.htm
dwr 後台推送技術 - is_zhoufeng的專欄 - 部落格頻道 - CSDN.NET
dwr3實現訊息精確推送詳細步驟 - 少年阿賓 - BlogJava
DWR Reverse Ajax功能實踐的要點 - 我愛佳娃 - BlogJava
Dwr website (detail zeush) recomm
.atitit.web 推送實現解決方案集合(3)----dwr3 Reverse Ajax