0

I have found many contributions to the core problem of my question, but no adequate solution.

I built a Java EE Web Application, which is based on a few HTML pages. These are formatted by the following styles.css:

* {
  font-family: sans-serif;
  padding: 9px;
  color: gray;
}
body > header {
  background-image: url("../img/tau.jpg");
  border-radius: 10px;  
  box-shadow: 5px 5px 9px gray;
}
a {
  color: white;
  text-decoration: none;
}
a:hover, h1.title {
  color: white;
  text-shadow: 0 0 10px white, 0 0 20px white;
}

Whenever I now deploye the application on my local Glassfish Appserver, I get the 404 thrown. The HTML pages are in the root directory, the images in the subdirectory /img and the styles.css in the subdirectory /css.

Unfortunately I haven't found a solution for this simple problem yet. Does anyone have an idea?

luk2302
  • 55,258
  • 23
  • 97
  • 137
rzett
  • 193
  • 2
  • 16
  • try to use background-image: url("/img/tau.jpg"); – Kurohige Nov 22 '18 at 20:03
  • Changed from: GET http://localhost:8080/testapp-web/resources/img/tau.jpg 404 (Not Found) to: GET http://localhost:8080/img/tau.jpg 404 (Not Found) – rzett Nov 22 '18 at 20:13
  • we need to see your directories tree – kret Nov 25 '18 at 20:37
  • @RZett please provide you directory structure (where you put the image). It's probably a bit overkill if you are using plain HTML, but in GlassFish you can use EL (Expression Language) in CSS: `background-image: url("#{resource['img:tau.jpg']}");` This notation is usually used in combination with JSP/JSF technology. The image should stay inside `webapp/resources/img` – xonya Dec 01 '18 at 14:16

0 Answers0