DWR 推技术???新订单提醒? 本帖最后由 jackie319 于 2010-12-10 09:20:13 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <body onload="dwr.engine.setActiveReverseAjax(true);sendMessage();">function sendMessage() { var storeId = document.getElementById("storeId").value; orderNotice.noticeNewOrder(storeId); }这个copy漏了。// 获得DWR上下文 WebContext wctx = WebContextFactory.get(); // 获取当前页面URL String currentPage = wctx.getCurrentPage(); /* ServletContext application = this.getServletContext(); application.getAttribute("orderId"); System.out.println("application"+application.getAttribute("orderId")); */ // 获取所有浏览当前页面的脚本session Collection<ScriptSession> sessions = wctx .getScriptSessionsByPage(currentPage); System.out.println("多少个客户端?" + sessions.size()); // 执行客户端脚本 ScriptBuffer script = new ScriptBuffer(); script.appendScript("receiveMessages("+num+");"); for (ScriptSession session : sessions) { session.addScript(script); }可是每刷新一下就有一个新的ScriptSeesion?不知道要怎么管理session。我现在写的例子推2次就停了。郁闷!!!! copy漏了。。为什么我的推了2次就停了呢? 关于jacob插件打开word文件的路径问题 Hibernate 的配置一个问题,基本配置 请教jstl问题 关于Session的问题 请教jsp与htm JavaScript的问题 怎样实现复选框全选功能? servlet运行时需要servlet-api.jar文件吗?我的目录下删除了它,程序还可以运行。 struts2实现的下载文件,可是用360浏览器下载的是一个jsp页面 请教使用JBuilder编写JSP的高手? js读取txt asp与jsp
function sendMessage() {
var storeId = document.getElementById("storeId").value;
orderNotice.noticeNewOrder(storeId);
}这个copy漏了。// 获得DWR上下文
WebContext wctx = WebContextFactory.get();
// 获取当前页面URL
String currentPage = wctx.getCurrentPage();
/* ServletContext application = this.getServletContext();
application.getAttribute("orderId");
System.out.println("application"+application.getAttribute("orderId"));
*/
// 获取所有浏览当前页面的脚本session
Collection<ScriptSession> sessions = wctx
.getScriptSessionsByPage(currentPage);
System.out.println("多少个客户端?" + sessions.size());
// 执行客户端脚本
ScriptBuffer script = new ScriptBuffer();
script.appendScript("receiveMessages("+num+");");
for (ScriptSession session : sessions) {
session.addScript(script);
}
可是每刷新一下就有一个新的ScriptSeesion?不知道要怎么管理session。我现在写的例子推2次就停了。郁闷!!!!
copy漏了。。为什么我的推了2次就停了呢?