使用DWR的推技术,怎么指定将信息推送到 某一个 打开的 浏览器啊?下面的代码是推送到所有的浏览器的。// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   JavaChat.javapackage com.example.dwr.reverseajax;import java.util.LinkedList;import javax.servlet.Servlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;import org.directwebremoting.Browser;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import org.directwebremoting.ui.dwr.Util;// Referenced classes of package com.example.dwr.reverseajax:
// Messagepublic class JavaChat { private final LinkedList messages = new LinkedList(); public JavaChat() {
} public void addMessage(String text) {
      if (text != null && text.trim().length() > 0) {
messages.addFirst(new Message(text));
}
Util.setValue("text", "");
Browser.withCurrentPage(new Runnable() {
public void run() {
Util.removeAllOptions("chatlog");
Util.addOptions("chatlog", messages, "text");
} });
}}

解决方案 »

  1.   

    传值么?    session
      

  2.   


    怎么做?说具体点   ,我用这个Browser.withSession(sessionId, task)试过,不行啊
      

  3.   

    是不是做在线客服类似的软件?
    ScriptBuffer sb = new ScriptBuffer();
    ScriptSession scr_session = WebContextFactory.get().getScriptSession();
    scr_session.addScript(sb);
    我以前是这样做的
      

  4.   


    我是想做这样的功能: 
       比如A用户和B用户都打开浏览器连接到服务器上了,我想从服务器给A客户发A的消息,B客户发B的小心,而不是发到所以用户。
      

  5.   

    从models中找一个唯一标识,然后查找相应用户的响应数据,然后存到session中,然后填充到也页面不就可以了吗?