JSF – Referencing resources in stylesheets

I recently ran into some trouble when trying to show a background image in a JSF page which was included via a stylesheet. When using

<h:outputStylesheet library="css" value="styles/styles.css" name="styles.css" />

to include the stylesheet into the JSF page, referencing resources (like images) in the CSS file need a special URL form. The typical form

html {
  background: url("/resources/images/bg.jpg")
}

(or any other path like that) will not work. The correct form is

html {
  background: url(#{resource['images/bg.jpg']});
}

JSF - Referencing resources in stylesheets auf Twitter teilen
JSF - Referencing resources in stylesheets flattrn
JSF - Referencing resources in stylesheets auf Digg teilen
JSF - Referencing resources in stylesheets auf Delicious teilen
JSF - Referencing resources in stylesheets auf Xing teilen
JSF - Referencing resources in stylesheets auf LinkedIn teilen
JSF - Referencing resources in stylesheets auf Pinterest teilen
JSF - Referencing resources in stylesheets auf StumbleUpon teilen
JSF - Referencing resources in stylesheets auf Tumblr. teilen
JSF - Referencing resources in stylesheets auf Pocket weiterlesen
Dominik Schadow auf Feedly abonnieren