spring3 mvc <mvc:resources <mvc:annotation-driven/>

spring 3.0.5 入引<mvc:resources后解决静态资源的问题,可是URL访问请求确不能解析,原来的servlet控制器不起作用了,尝试了半天最后<mvc:annotation-driven/> 问题解决。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

      
<!--       <mvc:resources mapping="/static/**" location="/"/>   -->
<!--           <mvc:default-servlet-handler/> -->
<!-- <mvc:default-servlet-handler  -->
<!--           default-servlet-name="default"/> -->
<mvc:resources mapping="/static/**" location="/WEB-INF/jsp/static/" /> 
 <mvc:annotation-driven/>  
 

	<!-- 激活Spring注解方式:自动扫描,并注入bean -->
	<context:component-scan base-package="org.xxx.blog.action" />

	<!-- 配置视图解析 -->
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>
<!-- 	  <mvc:resources mapping="/static/**" location="/static/" />  -->
</beans>

猜你喜欢

转载自gyl868.iteye.com/blog/1405722