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進(jìn)行配置:

          <action path="/XXXX"

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

          然后在Spring中進(jìn)行bean的配置:

          <bean name="/XXXX"

          這里為需要用到的class,通過Ioc來進(jìn)行配置

          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)

          搜索

          最新評論

          主站蜘蛛池模板: 固原市| 松原市| 连州市| 昌平区| 东明县| 富平县| 晋中市| 右玉县| 城固县| 武鸣县| 南陵县| 长乐市| 清原| 长宁县| 庆元县| 青海省| 景洪市| 济阳县| 奎屯市| 伊春市| 宜兰市| 邹平县| 墨竹工卡县| 芦山县| 桃园市| 图们市| 临泽县| 萝北县| 政和县| 巫山县| 砚山县| 牟定县| 万山特区| 丹凤县| 黄龙县| 沈丘县| 章丘市| 屯留县| 贵定县| 东海县| 哈密市|