Background
I am developing an application (with Spring MVC
) with its base path as:
http://localhost:8080/myapplication/
Use the JSTL c:url tag.
<c:url value="/css/style.css" var="url" />
<link rel="stylesheet" href="${url}" type="text/css" media="screen, projection">
You can also use the pageContext to prefix the context path.
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css" media="screen, projection">