I have a simple html page. But css files doesn't download in the page. I have an error 404 when I try show image in <style>
tags in the page. Nothing works.
home.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<meta charset="utf-8">
<title>Title</title>
<link href="../../assets/css/style.css" rel="stylesheet">
<link href="../../assets/css/bootstrap.css" rel="stylesheet">
<style>
/*h2{*/
/*color: red;*/
/*}*/
body {
background: url(../../assets/img/javarush.jpg);
}
</style>
</head>
<body>
<div class="home">
<h2>Hello World!</h2>
</div>
<button class="bg-primary btn-primary btn-lg">Button</button>
</body>
</html>
style.css
.home {
background-image: url('/assets/img/javarush.jpg');
background-size: cover;
}
h2{
color: #2b542c;
}
UPDATE: works only so
<style>
<%@include file="/assets/css/style.css"%>
</style>
but image not found
UPDATE 2: in dispatcherServlet
write <mvc:resources mapping="/assets/**" location="/assets/"/>
and in .jsp write
<link href="<c:url value="/assets/css/bootstrap.css" />" rel="stylesheet">
<link href="<c:url value="/assets/css/style.css" />" rel="stylesheet">
and it works great with image.