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 閱讀(93) 評論(0)  編輯  收藏


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


          網站導航:
           

          公告

          希望有一天

          我能用鼠標雙擊我的錢包

          然后選中一張100元

          按住“ctrl+c”

          接著不停的“ctrl+v”

          嘻嘻~~~笑醒~~~



          導航

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

          統計

          常用鏈接

          留言簿(6)

          隨筆分類(102)

          隨筆檔案(398)

          文章分類

          文章檔案(10)

          有趣網絡

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 沈阳市| 老河口市| 永年县| 西藏| 长沙市| 三明市| 莱阳市| 景德镇市| 虞城县| 武穴市| 阜新市| 封丘县| 龙海市| 类乌齐县| 永州市| 望奎县| 阜新| 永福县| 寻甸| 徐汇区| 通城县| 绵阳市| 介休市| 武川县| 神农架林区| 民县| 邹平县| 南丹县| 苍溪县| 泾阳县| 永德县| 杂多县| 拉孜县| 刚察县| 犍为县| 汝阳县| 枣强县| 和静县| 修水县| 石家庄市| 新源县|