dwr2反推

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

 

posted @ 2013-08-15 10:22  horizon~~~  阅读(235)  评论(0编辑  收藏  举报