dwr Util getScriptSessionsByPage is deprecated

乔哥 2013-07-15 04:31:25
今天做dwr反推,发现dwr 中的 Util 和 getScriptSessionsByPage is deprecated,个人认为应该是有新的方法替代了这两个,但是自己找了半天没找到,求助各位,是否知道是哪些方法...
...全文
123 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
乔哥 2013-08-15
  • 打赏
  • 举报
回复
package services;

import org.directwebremoting.Browser;
import org.directwebremoting.ScriptSessions;
import org.directwebremoting.ServerContextFactory;
import org.directwebremoting.ui.dwr.Util;

public class HelloServices {
	public String sayHello(String name) {
		System.out.println("Hello now!");
		reverserHello();
		return "Hello " + name + "!";
	}

	/**
	 * 反推
	 */
	public void reverserHello() {
		String page = ServerContextFactory.get().getContextPath() + "/dept.jsp";
		Browser.withPage(page, new Runnable() {
			public void run() {
				ScriptSessions.addFunctionCall("divShow", "alert");
				Util.setValue("result", "hello horizon!!!");
			}
		});
	}
}
乔哥 2013-08-15
  • 打赏
  • 举报
回复
看来只有自己结了,我用的别的方法解决的,就是调用页面的js:
		String page = ServerContextFactory.get().getContextPath()
				+ "/getStockInfo.html";
		while (true) {
			Thread.sleep(500);
			if (closeMarket) {
				break;
			}
			Browser.withPage(page, new Runnable() {
				public void run() {
					ScriptSessions.addFunctionCall("receiveMessages",
							"this is horizon's demo!");
				}
			});
		}

25,985

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧