SpringMVC 配置文件
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.0.xsd
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">
加上这三段标签 location指定static文件夹路径在WebContent下,mapping属性是访问url的映射,cache-period是缓存机制,604800缓存一周.
区别上面还要一种简单的用法:
但不建议使用.
最后还要加上
不然Controller视图会无效.
比如访问
http://127.0.0.1/项目名/css/index.css
http://127.0.0.1/项目名/css/index.js
http://127.0.0.1/项目名/css/index.jpg