25,985
社区成员
发帖
与我相关
我的任务
分享
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!!!");
}
});
}
}
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!");
}
});
}