Spring學習心得(四)

           

           

           

           

          Spring學習心得(四)

          1.       SpringStruts連接:為了在Struts中使用Spring ,需要在Strutscongfig中加入

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

                  <set-property property="contextConfigLocation"

                      value="/WEB-INF/applicationContext.xml"/>

              </plug-in>

          2.       對于actionSpring的應用有兩種方法:

          a)       Extends ActionSupport,使用其中的getWebApplicationContext()得到ApplicationContext,在通過getBean()方法得到所需要的類,不過這樣的話Struts就和Spring耦合在一起了。

          b)      重新Delegating actions :在Strutscongfig進行配置:

          <action path="/XXXX"

          type="org.springframework.web.struts.DelegatingActionProxy"/>

          然后在Spring中進行bean的配置:

          <bean name="/XXXX"

          這里為需要用到的class,通過Ioc來進行配置

          class="XXXXXXXX">

          <property name="YYYY">

          <ref bean="YYYY"/>

          </property>

          </bean>

          <bean id="YYYY" class="YYYYYY">

          </bean>

          當然也可以在struts中加入

          <controller processorClass=

          "org.springframework.web.struts.DelegatingRequestProcessor"/>

          這樣就只需要寫

          <action path="/XXXX"/>就可以了,DelegatingRequestProcessor能夠自動分派

           

          posted on 2007-09-05 10:21 劉錚 閱讀(287) 評論(0)  編輯  收藏 所屬分類: Spring

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

          導航

          統計

          留言簿(1)

          文章分類(141)

          文章檔案(147)

          搜索

          最新評論

          主站蜘蛛池模板: 军事| 师宗县| 榕江县| 甘肃省| 武义县| 汕尾市| 永嘉县| 策勒县| 舟曲县| 乌兰浩特市| 兰考县| 丹棱县| 金沙县| 广东省| 云梦县| 阿城市| 香港| 龙岩市| 禹城市| 福州市| 桃园县| 千阳县| 亳州市| 孟村| 成都市| 辽宁省| 金阳县| 太湖县| 兴安县| 论坛| 郁南县| 镇沅| 绵竹市| 社会| 尤溪县| 修水县| 永顺县| 洪江市| 淮滨县| 高要市| 宜春市|