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

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

          或小型應用可簡單寫成最直接的<plug-in className= "org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property= "contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>


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

          struts-config.xml中還應有:
           <controller>
            <set-property property="processorClass" value="org.springframework.web.struts.DelegatingRequestProcessor"/>
           </controller>
          posted on 2007-06-15 12:16 lzj520 閱讀(270) 評論(0)  編輯  收藏 所屬分類: Spring個人學習日記
          主站蜘蛛池模板: 迁西县| 田林县| 玛曲县| 蒙阴县| 凤庆县| 全州县| 观塘区| 二连浩特市| 武乡县| 江西省| 蓝山县| 楚雄市| 北流市| 沾益县| 武定县| 平潭县| 苏州市| 宁国市| 北安市| 阜阳市| 道真| 涞源县| 萍乡市| 环江| 石河子市| 马公市| 临湘市| 健康| 天水市| 邻水| 体育| 永安市| 凭祥市| 彝良县| 朔州市| 平顺县| 垦利县| 武宁县| 铜鼓县| 莆田市| 邵武市|