posts - 48, comments - 13, trackbacks - 0, articles - 0
            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          轉(zhuǎn)自:http://www.nabble.com/sctx.getScriptSessionsByPage%28%29-problems-td19552209.html#a19552209

          Hi,

          Thanks for your response. So for the following code what is the updated
          version?

          CODE:

          Update/modify the calling client only:

             WebContext wctx = WebContextFactory.get();
             if(wctx != null)
             {
               Util utilThis = new Util(wctx.getScriptSession());
               utilThis.setValue("web Page Element Name", "Web Page Element Value");
             }


          import org.directwebremoting.ui.dwr.Util; /* i.e. NOT proxy.dwr.Util */
          Util.setValue("web Page Element Name", "Web Page Element Value");

           

           

          update all connected browsers viewing the relevant page:

           WebContext wctx = WebContextFactory.get();
           if (wctx != null)
           {
             String currentPage = wctx.getCurrentPage();
             Collection sessions = wctx.getScriptSessionsByPage(currentPage);
             Util utilAll = new Util(sessions);
             utilAll.addFunctionCall("createTable",tData);
           }

           


          final Object tData = ...;
          Browser.withCurrentPage(new Runnable() {
              public void run() {
                  ScriptSessions.addFunctionCall("createTable", tData);
              }
          });

           

           

          update all browsers for a specific page (non DWR started thread)

           servletContext = WebContextFactory.get().getServletContext();
           sctx = ServerContextFactory.get(servletContext);
           if (sctx != null)
           {
              Collection sessions = sctx.getScriptSessionsByPage("/stocksdemo/");
              Util utilAll = new Util(sessions);
              utilAll.addFunctionCall("function To Call","Data to pass");
           }

           


          Browser.withPage("/stocksdemo/",  new Runnable() {
              public void run() {

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 西安市| 察隅县| 铜鼓县| 莱州市| 清河县| 会宁县| 光山县| 青龙| 抚顺市| 龙川县| 城固县| 大关县| 喀喇| 准格尔旗| 多伦县| 密云县| 来安县| 长春市| 民乐县| 玉林市| 洪泽县| 阿拉善右旗| 肇庆市| 集贤县| 镇雄县| 峡江县| 班玛县| 潢川县| 卓尼县| 民县| 宝兴县| 通河县| 呈贡县| 房产| 江安县| 石阡县| 定日县| 巨鹿县| 车险| 金昌市| 筠连县|