I am trying to link a css to my jsp page but I keep getting a 404 page not found error.
href in the homepage.jsp: <link href="../resources/css/welcome.css" rel="stylesheet" />
file structure:
-->webapp
-->img
-->resources
-->css
-->welcome.css
-->WEB-INF
-->views
-->homepage.jsp
As you're using Spring MVC:
<link href="<c:url value="/resources/css/welcome.css" />" rel="stylesheet">
If you hate JSTL, you can use the “page context” variable to get the resources like this :
<link href="${pageContext.request.contextPath}/resources/css/welcome.css" rel="stylesheet" >
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.