如果是在struts-config.xml中直接寫(xiě)為 <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"/>  ,則是默認(rèn)配置文件為在WEB-INF下的action-servlet.xml文件,可在action-servlet.xml中再截入各個(gè)action bean的配置,如<import resource="modules/spring-config-login.xml"/>等。
          另外service的配置和applicationContext.xml或sping相關(guān)的數(shù)據(jù)庫(kù)文件,可自己建立一個(gè)目錄,然后在web.xml中加載    <context-param>
                  <param-name>contextConfigLocation</param-name> 
                  <param-value>classpath*:spring/*.xml</param-value>
              </context-param>  
          這樣將web層和service層的配置分開(kāi)擺放,看起來(lái)比較清晰。具體可參考springside的example

          另一方法是struts-config中直接寫(xiě) <plug-in  className="org.springframework.web.struts.ContextLoaderPlugIn"> 
          <set-property property="contextConfigLocation"  value="classpath*:spring/*.xml"/> 
          </plug-in>
          這樣將所有的配置文件直接放在spring目錄下

          或小型應(yīng)用可簡(jiǎn)單寫(xiě)成最直接的<plug-in className= "org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property= "contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>


          不過(guò)多句提醒下記得不要漏了web.xml中還應(yīng)有    <listener> 
              <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
           </listener> 

          struts-config.xml中還應(yīng)有:
           <controller>
            <set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
           </controller>
          posted on 2007-06-15 12:16 lzj520 閱讀(267) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Spring個(gè)人學(xué)習(xí)日記
          主站蜘蛛池模板: 陈巴尔虎旗| 桃园市| 景谷| 乌苏市| 南岸区| 志丹县| 咸宁市| 永宁县| 南和县| 木兰县| 颍上县| 方正县| 宾川县| 毕节市| 罗源县| 宁阳县| 安泽县| 师宗县| 松原市| 丰都县| 建平县| 西吉县| 海阳市| 卢龙县| 衡南县| 娱乐| 松阳县| 民乐县| 秭归县| 台南县| 乌兰察布市| 抚松县| 东兴市| 巩留县| 游戏| 广宗县| 基隆市| 高陵县| 株洲市| 万载县| 新安县|