Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource library getting ignored in h:graphicImage

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.

like image 344
casolorz Avatar asked Dec 14 '12 02:12

casolorz


1 Answers

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" />
like image 127
BalusC Avatar answered Oct 01 '22 05:10

BalusC