springmvc中的怎么配置多个*-servlet.xml文件
web.xml文件
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/test-servlet.xml /WEB-INF/simpleclient-servlet.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
我在默认的springapp-servlet.xml中包含*-servlet.xml
<import resource="test-servlet.xml"/>
<import resource="simpleclient-servlet.xml"/>
但运行后系统似乎只能识别最后一个simpleclient-servlet.xml
test-servlet.xml并不能加载执行
各位怎么解决多servlet.xml的配置问题
------解决方案--------------------
你就直接创建多个这样的XXX-servlet.xml
web.xml中这样配置
Java code
<servlet>
<servlet-name>dmt</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springweb/*-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dmt</servlet-name>
<url-pattern>*.do</url-pattern> <!--匹配跳转的后缀名-->
</servlet-mapping>
------解决方案--------------------
那就得看你的servlet中式怎么配置的啦!其实不一定要.do,自已定的协议,随便什么都行的,.htm也可以啊!只要是一致的就行
Java code
<bean id="operator.webUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/operator/logList.do">operator.logListController</prop>
</props>
</property>
</bean>
<!-- controller -->
<bean id="operator.logListController" class="tyt.dmt.component.operator.webapp.controller.logListController" >
<property name="powerService" ref="powerService"></property>
</bean>
------解决方案--------------------