I have the following tag:
<h:graphicImage value="Circle_Yellow.png" library="images" />
In my folder I have the following structure:
/resources/images/.....
/WEB-INF/....
/*.xhtml
When rendered that image shows up as:
<img src="Circle_Yellow.png">
However I do see other things using resources, for example
<script type="text/javascript" src="/www/javax.faces.resource/jquery/jquery.js.xhtmlln=primefaces"></script>
And if I go to /www/javax.faces.resource/Circle_Yellow.png?ln=images
it works.
So what could I possibly be doing wrong that my library gets ignored on the h:graphicImage. Also it isn't just as an image, I have a css file that is failing too.
I'm using mojarra 2.1.16 and primefaces 3.4.1.
The value
attribute takes an URL, not the resource name. To specify the resource name, use the name
attribute.
<h:graphicImage library="images" name="Circle_Yellow.png" />
See also the <h:graphicImage>
tag documentation for details.
Unrelated to the concrete problem, your usage of the library
attribute is not entirely right. Please carefully read What is the JSF resource library for and how should it be used? You should be using it as
<h:graphicImage name="images/Circle_Yellow.png" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With