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!!!");
}
});
}
}