在多個人做同一個項目的時候肯定需要使用多個struts_config.xml文件和多個applicationContext.xml文件。那麼怎麼配置這些文件呢?
首先配置多個struts_congfig.xml文件。。 在web.xml中寫下面的代碼:
config
/WEB-INF/struts-config.xml,/WEB-INF/struts-config_mhb.xml,/WEB-INF/struts-config_zzg.xml,/WEB-INF/struts-config_lf.xml,/WEB-INF/struts-config_sx.xml
(前提是保證這幾個文件的存在。)
這樣多個struts_config.xml的配置文件就完了。。
繼續配置多個applicationContext.xml文件。這個是在struts_config.xml文件下完成的:
className="org.springframework.web.struts.ContextLoaderPlugIn">
value="/WEB-INF/classes/applicationContext.xml,/WEB-INF/classes/applicationContext_zzg.xml,/WEB-INF/classes/applicationContext_mhb.xml" />
(也是要保證文件的存在)
這樣就配置完了。 有的人配置多個applicationContext.xml文件也在XML下配置。配置代碼如下:
contextConfigLocation
classpath:/applicationContext*.xml
(這種方式的配置是所有applicationContext.xml文件都在classes下)。