spring mvc对静态资源的处理
2016-08-10 14:58
232 查看
1.web.xml中拦截的url设置为/来让sping mvc 处理
2.Restful风格(@PathVariable("参数"))
3.对静态资源的处理
在spring-mvc.xml中添加
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="/images/"/>
<mvc:resources mapping="/resources2/**" location="/css/"/>
4.如要使用images下的图片在jsp页面中可以:
<img alt="文章列表" src="${pageContext.request.contextPath}/resources/article_list.jpg">
如果使用css样式
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources2/css.css"/>
</head>
2.Restful风格(@PathVariable("参数"))
3.对静态资源的处理
在spring-mvc.xml中添加
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="/images/"/>
<mvc:resources mapping="/resources2/**" location="/css/"/>
4.如要使用images下的图片在jsp页面中可以:
<img alt="文章列表" src="${pageContext.request.contextPath}/resources/article_list.jpg">
如果使用css样式
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/resources2/css.css"/>
</head>
相关文章推荐
- Spring MVC静态资源处理
- Spring MVC 表单标签 & 处理静态资源
- spring mvc 自定义处理静态资源
- spring mvc - 对静态资源的处理
- Spring MVC静态资源处理
- Spring MVC 静态资源处理
- Spring MVC静态资源处理
- Spring MVC静态资源处理
- Spring MVC中处理静态资源的多种方法
- Spring MVC中处理静态资源的多种方法
- Spring MVC 处理静态资源文件
- Spring MVC静态资源处理
- Spring MVC静态资源处理——<mvc:resources /> ||<mvc:default-servlet-handler /> 转载
- spring mvc静态资源处理
- spring mvc - 对静态资源的处理
- Spring MVC 获取静态资源处理方案学习总结
- Spring MVC 获取静态资源处理方案学习笔记
- Spring MVC 中处理静态资源
- Spring MVC静态资源处理
- Spring MVC静态资源处理