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

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

          Posted on 2009-03-14 22:19 董銳 閱讀(2911) 評論(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() {

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


          網站導航:
           
          主站蜘蛛池模板: 永寿县| 宝丰县| 久治县| 甘德县| 阿巴嘎旗| 乐山市| 临潭县| 兴仁县| 波密县| 广安市| 东乡县| 黑山县| 交口县| 乌恰县| 靖远县| 渝中区| 新建县| 湟中县| 漠河县| 楚雄市| 洞头县| 施秉县| 四子王旗| 英山县| 游戏| 香港| 姚安县| 石台县| 青河县| 竹北市| 教育| 格尔木市| 邢台市| 碌曲县| 香格里拉县| 治多县| 平利县| 石首市| 嘉峪关市| 隆子县| 石狮市|