zhuguifei
2026-03-10 2c1fd10c6fbabb8e9f0e9f07fe66fb36c008e883
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.shlanbao.tzsc.utils.tools;
 
import net.sf.json.JSONArray;
 
import org.directwebremoting.Browser;
import org.directwebremoting.ScriptSessions;
import org.directwebremoting.ServerContextFactory;
 
import com.shlanbao.tzsc.pms.sys.repairResquest.beans.RepairResquestBean;
 
 
public class DwrPush {
    
    /**
     * 推送信息到任意页面
     * 
     * @param url
     *            除去项目根路径外的action路径名,以"/"开头
     * @param functionName
     *            前台页面JS函数名
     * @param message
     *            需要推送的信息
     * @author  pushMsgToAnyJSP(String url, final String functionName,final Object... message)
     * */
    public static void pushMsgToAnyJSP(String url, final String functionName,final RepairResquestBean rb) {
        Browser.withPage(ServerContextFactory.get().getContextPath() + url,new Runnable() {
                    public void run() {
                        //将对象转转成字符串
                        JSONArray json=new JSONArray().fromObject(rb);
                        String jsonstr = json.toString();
                        ScriptSessions.addFunctionCall(functionName, jsonstr);
                    }
                });
    }
 
 
}