hailor

          Grails and DWR

               前段時間學過一點DWR,現(xiàn)在在學Grails,覺得還挺好用的,于是就想著有沒有辦法將這兩個好東西用到一起來,看了Grails的文檔,發(fā)現(xiàn)里面有這個plugin,grails的wiki里面也有介紹如何使用.
          我就照著wiki上面說的一做,發(fā)現(xiàn)我一輸grails install-plugin dwr 出了一段輸出后就沒有下文了

          Microsoft Windows XP [版本 5.1.2600]               
          (C) 版權所有 1985-2001 Microsoft Corp.           

          C:\Documents and Settings\hailor>cd /d D:\grails      

          D:\grails>cd dwrdemo                                              

          D:\grails\dwrdemo>grails install-plugin dwr              

          Welcome to Grails 1.0-RC2 - http://grails.org/            
          Licensed under Apache Standard License 2.0                  
          Grails home is set to: C:\grails                                

          Base Directory: D:\grails\dwrdemo                              
          Environment set to development
          Running script C:\grails\scripts\InstallPlugin.groovy           
          Plugins list cache does not exist or is broken, recreating ...
          Plugins list cache has expired. Updating, please wait... ... 

          上面還有一個Demo,不過這個demo下載得還真是夠郁悶的,下了半天才下過來,不過下過來了也要安裝dwr plugin才能用.后來經過一番探索,終于找到了正確的方法:

          1,從這個網站下載那個grails-dwr-0.1.zip
          2,切換你的程序目錄下輸入 grails install-plugin XXXXX\grails-dwr-0.1.zip   前面的XXXXXX表示你放包的目錄
          3,現(xiàn)在你的dwr plugin 安裝好了
          4,打開 \grails-app\conf下的BootStrap.groovy 改為(看了那個wiki,這段程序的意思也就很明了了,不同的是wiki里面的文件是DwrConfigBootStrap.groovy,不過其實沒什么兩樣 )
           

          class BootStrap {

               def init 
          = { servletContext ->
               }

               def destroy 
          = {
               }

               def dwrconfig
          ={
               service(name:
          'helloService', javascript:'HelloService'{
                      include(
          'hello')
                  }

               }

          }
           

          5,創(chuàng)建一個helloService  grails create-service hello

          class HelloService {
              
              
          boolean transactional = true

              def hello() {
                
          "hill is here"
              }
          }


          6,運行 grails run-app
          7,輸入這個http://localhost:8080/dwrdemo/dwr查看(沒錯的話應該會看一個HelloService);

          posted on 2007-12-29 14:37 hailor 閱讀(468) 評論(0)  編輯  收藏


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


          網站導航:
           

          導航

          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          統(tǒng)計

          常用鏈接

          留言簿(1)

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 贵定县| 和平区| 扎鲁特旗| 乐亭县| 洱源县| 富锦市| 静乐县| 邵东县| 巫山县| 股票| 宁都县| 祁阳县| 高州市| 平江县| 康定县| 涪陵区| 鲁山县| 民权县| 柳河县| 常州市| 正蓝旗| 务川| 毕节市| 宝丰县| 安吉县| 法库县| 二连浩特市| 辽宁省| 奉节县| 襄垣县| 青海省| 磐石市| 宜丰县| 应用必备| 无棣县| 天柱县| 敦煌市| 邹平县| 增城市| 东方市| 洛隆县|