Loading...

          java .net

          2007-1-15 星期一

          今天練習了dwrstrutsspring集成,其中與struts集成有點小錯誤還沒查出來,在網上找資料也沒有解決。Spring集成倒是挺爽的,順便回顧了spring的設置,如果springstrtus集成,首先無論哪種方式都需要在struts-config.xml中以插件方式引入spring的一個加載類ContextLoaderPlugin

          <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">

             <set-property property="contextConfigLocation"  value="/WEB-INF/applicationContext.xml" />

          </plug-in>

          可以用spring的一個接口DelegatingRequestProcessor替換org.apache.struts.action.RequestProcessor類,在web.xml中設置.

           還可以將strutsAction類交給spring的代理類來處理。

          還有就是如果只是簡單web應用,不用struts,那么在web.xml配置文件中配置一個spring監聽器或者servlet,例如

          <context-param>

              <param-name>contextConfigLocation</param-name>

              <param-value>/WEB-INF/classes/applicationContext.xml</param-value>

            </context-param>

           

            <listener>

             <listener-class>org.springframework.web.context.ContextLoaderListener

          </listener-class>

            </listener>

          這樣在用到spring Ioc中的對象時就用WebApplicationContextUtils來加載。

          posted on 2008-08-26 22:06 閱讀(101) 評論(0)  編輯  收藏


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


          網站導航:
           

          公告

          希望有一天

          我能用鼠標雙擊我的錢包

          然后選中一張100元

          按住“ctrl+c”

          接著不停的“ctrl+v”

          嘻嘻~~~笑醒~~~



          導航

          <2008年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          統計

          常用鏈接

          留言簿(6)

          隨筆分類(102)

          隨筆檔案(398)

          文章分類

          文章檔案(10)

          有趣網絡

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 巨野县| 蕉岭县| 鄂尔多斯市| 浮梁县| 孟州市| 吉木萨尔县| 温州市| 饶阳县| 常熟市| 勐海县| 逊克县| 富顺县| 巴楚县| 沙湾县| 镇巴县| 东乡族自治县| 长兴县| 虎林市| 婺源县| 蒙阴县| 信宜市| 屏南县| 固原市| 略阳县| 光泽县| 体育| 武宣县| 栾城县| 天等县| 台中县| 柳江县| 铜山县| 娄底市| 连南| 巨鹿县| 新巴尔虎左旗| 华亭县| 阳山县| 蒲城县| 云龙县| 张家口市|