i\'m in trouble here. I have a JSF application that has a template file called baseTemplate.xhtml. This file is located in /resources/template folder. Follo
CSS background images are loaded relative to the request URL of the CSS file (and thus not immediately relative to its physical location in the web content). If you explore the generated HTML output of the
, then you'll see that the request URL has become different. Assuming a context path of /somecontext
and a FacesServlet
mapping of *.xhtml
, it'll look like this:
Note that your (improper btw) usage of the library
has moved the /css
to ?ln=css
. You'd need to fix the background image url()
accordingly so that it's properly relative to the real request URL of the CSS. E.g.
background-image: url("../resources/css/imgSite/sisLogo.png");
A more reliable way, which takes JSF resource identifier rules and FacesServlet
mapping into account, is to use #{resource}
in EL:
background-image: url("#{resource['css:imgSite/sisLogo.png']}");