如果是在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個人學習日記
          主站蜘蛛池模板: 腾冲县| 宝清县| 镇雄县| 油尖旺区| 临安市| 阳山县| 邳州市| 通许县| 客服| 曲阜市| 永安市| 永丰县| 泰州市| 建平县| 井陉县| 灵石县| 澜沧| 静宁县| 黄陵县| 和静县| 澄江县| 萨迦县| 班玛县| 宜昌市| 新平| 陆河县| 永吉县| 姚安县| 宜黄县| 台中市| 嵊州市| 德阳市| 乌苏市| 嘉定区| 新兴县| 石嘴山市| 江山市| 芦溪县| 安远县| 随州市| 会同县|