java - CSS files doesn't download in JSP page -


i have simple html page. css files doesn't download in page. have error 404 when try show image in <style> tags in page. nothing works.

catalog structure here.

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 so

<style>         <%@include file="/assets/css/style.css"%> </style> 

but image not found

update 2: in dispatcherservlet write <mvc:resources mapping="/assets/**" location="/assets/"/> , 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 works great image.

.home {     background-image: url('../img/javarush.jpg'); } 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -