posts - 48, comments - 13, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          從dwr2.0到dwr3.0的轉換(轉載)

          Posted on 2009-03-14 22:19 董銳 閱讀(2912) 評論(0)  編輯  收藏

          轉自: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() {

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 黎城县| 镇坪县| 峨眉山市| 若羌县| 囊谦县| 连州市| 开鲁县| 安溪县| 沂南县| 九寨沟县| 瑞昌市| 英山县| 镇平县| 泗洪县| 新巴尔虎左旗| 工布江达县| 泾阳县| 南江县| 武汉市| 邯郸县| 达日县| 四川省| 姜堰市| 昭觉县| 徐州市| 易门县| 承德县| 固始县| 林芝县| 黎城县| 宜城市| 金堂县| 玉门市| 洞头县| 湘乡市| 潢川县| 义马市| 镇平县| 青州市| 通河县| 太仆寺旗|