如果是在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個人學習日記
          主站蜘蛛池模板: 剑河县| 达州市| 民乐县| 枝江市| 五常市| 花莲市| 梨树县| 六枝特区| 尼木县| 湖州市| 赤壁市| 县级市| 长宁区| 惠东县| 遂川县| 长乐市| 包头市| 佳木斯市| 台北市| 连南| 潮安县| 洪江市| 广州市| 乌兰察布市| 宜城市| 吐鲁番市| 驻马店市| 林口县| 怀化市| 化隆| 荣成市| 子洲县| 松江区| 遂川县| 墨脱县| 宾川县| 定州市| 长海县| 金山区| 苍南县| 舟山市|