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)

          有趣網絡

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 克东县| 德惠市| 抚州市| 北票市| 麻城市| 昌图县| 文山县| 临猗县| 诸城市| 巴里| 志丹县| 安龙县| 横山县| 乌鲁木齐县| 神木县| 深圳市| 施秉县| 正阳县| 龙川县| 淮阳县| 四平市| 五家渠市| 长治市| 视频| 德昌县| 宜春市| 洛川县| 东明县| 达孜县| 沛县| 冕宁县| 东乌珠穆沁旗| 金门县| 格尔木市| 江油市| 新营市| 建德市| 广汉市| 子洲县| 镇坪县| 商南县|