Spring學(xué)習(xí)心得(四)

           

           

           

           

          Spring學(xué)習(xí)心得(四)

          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的應(yīng)用有兩種方法:

          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>

          當(dāng)然也可以在struts中加入

          <controller processorClass=

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

          這樣就只需要寫

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

           

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

          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          導(dǎo)航

          統(tǒng)計

          留言簿(1)

          文章分類(141)

          文章檔案(147)

          搜索

          最新評論

          主站蜘蛛池模板: 香格里拉县| 盐津县| 玉山县| 苍梧县| 神池县| 东乌珠穆沁旗| 临潭县| 明星| 赤峰市| 手游| 清原| 江陵县| 烟台市| 林甸县| 丰原市| 师宗县| 池州市| 红河县| 泰顺县| 塔城市| 湘潭县| 五寨县| 南靖县| 蓝田县| 阿拉善盟| 德江县| 庄浪县| 潜山县| 分宜县| 英山县| 宝丰县| 驻马店市| 安顺市| 翁源县| 登封市| 乌拉特后旗| 桦川县| 疏附县| 郁南县| 开化县| 南木林县|