本文介绍了Spring不能加载我的css文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Spring无法加载我的CSS文件,这是我的架构:
- 项目
- Webcontent
- WEB-INF
- pages
- jsp
- css
- jquery-ui.css
h2_lin>解决方案 - Project
- Webcontent
- WEB-INF
- pages
- index.jsp
- css
- jquery-ui.css
- pages
您可以将css文件和其他文件(如javascript,图像)放在文件夹资源中 项目
Webcontent 资源 css jquery-ui.css WEB-INF pages 索引。 jsp将以下行放入spring配置
< mvc:resources mapping =/ resources / **location =/ resources //>并在jsp页面中提供
< link href =$ {pageContext.request.contextPath} /resources/css/jquery-ui.css rel =stylesheet>Spring can't load my css files and this is my architecture:
You can put the css file and other files like javascript, images in the folder resources Project
Webcontent resources css jquery-ui.css WEB-INF pages index.jspAnd put the following line in spring configuration
<mvc:resources mapping="/resources/**" location="/resources/" />And give the reference in jsp pages like
<link href="${pageContext.request.contextPath}/resources/css/jquery-ui.css" rel="stylesheet"> - pages
更多推荐
Spring不能加载我的css文件
发布评论