spring mvc 静态资源映射

<?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:context="http://www.springframework.org/schema/context"
 xmlns:mvc="http://www.springframework.org/schema/mvc"
 xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
    <context:component-scan base-package="myWeb"></context:component-scan>
    <mvc:annotation-driven></mvc:annotation-driven> --------------------开启
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
     <property name="prefix" value="/"></property>
      <property name="suffix" value=".jsp"></property>
    </bean>
    <mvc:resources mapping="/**" location="/css/" cache-period="31556926"/   -----location 为存放位置,根目录为WebContent  mapping为url映射的路径
   
   
</beans

posted @ 2018-03-27 05:36  2年又2年  阅读(192)  评论(0编辑  收藏  举报