我不熟悉spring+struts+ibatis配置文件
对ssi不熟悉导致经常纠结于各种配置文件,对其如何整合也似懂非懂。干脆来写写罢(主要写我不熟悉的,路过的同志可能不适合阅读此文)
一、web.xml
1、contextConfigLocation:Spring容器启动时需要加载Spring的配置文件,默认是/WEB-INF目录下的applicationContext.xml文件。当然也可以放在classpath下,可以包括多个spring配置文件----这就得依靠contextConfigLocation。
<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param>
nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml,/WEB-INF/a.xml;classpath:c.xml</param-value> </context-param>
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:config/applicationContext-*.xml</param-value> </context-param>
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
<servlet> <servlet-name>context</servlet-name> <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> <load-on-startup>1</load-on-startup></servlet>
<filter><filter-name>struts</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class></filter><filter-mapping><filter-name>struts</filter-name><url-pattern>/*</url-pattern></filter-mapping>
<import resource="applicationContext-2.xml"/>
<bean id="propertyConfigurer" name="code"><bean id="sqlMapClient" value="WEB-INF/sql-map-config.xml"/></bean>
<settings cacheModelsEnabled="true" enhancementEnabled="true" lazyLoadingEnabled="true" errorTracingEnabled="true" maxRequests="32"maxSessions="10" maxTransactions="5" useStatementNamespaces="true" />
<properties resource="database.properties"/>
<sqlMap resource="com/ailk/liaofeng/user/dao/ibatis/SystemUser.xml" />
<constant name="struts.objectFactory" value="spring"/><include file="newstruts.xml"/>