Search code examples
jsfprimefacesgraphicimage

graphicImage does not charge using jsf and primefaces


I am trying to make an image appear in a project using primefaces. I am using graphicImage but when i run the program, the image does not appear correctly. I have the image in a resoure folder, and in the WEB-INF folder

I am using this code:

       <p:graphicImage value="image1.png" rendered="true"/>

Solution

  • If your image is inside the resources folder you need to point to it:

    <p:graphicImage value="/resources/image1.png" />
    

    Even better if you create a folder named images inside the resources folder, to keep it nice and clean like this:

    <p:graphicImage value="/resources/images/animation-iris-small.gif" />
    

    enter image description here