to load image in css
i have one problem:
if i want to load an image from a rightcontext i do it so:
<h:graphicImage url="<%=request.getContextPath() %>/img/myImage.gif"/>
now i would like to use css (styleClass) and image should be loaded there:
unfortunately no one of these possibilities works
.myImage
{
background: url('img/myImage.gif');
background: url('<%=request.getContextPath() %>img/myImage.gif');
background: url('<%=request.getContextPath() %>'+'img/myImage.gif');
}
how can i load the image in css with right context?
[784 byte] By [
naekoa] at [2007-11-27 10:12:11]

# 1
You don't need to specify request.getContextPath() in your CSS file simply provide a path in your CSS like background: url(relative path w.r.t. your context root).
E.g. background-image: url("btnbg.bmp"); if the image is in the current directory as the CSS.
Please ensure that you have linked the CSS into your JSF page with a
<portlet:defineObjects />
<LINK rel="stylesheet" type="text/css"
href='<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/theme/stylesheet.css") %>'
title="Style">