0

I'm using PrimeFaces version 5.2 and Glassfish as server to deploy my results. I've coded a short example in order to download a file from the server and I'm getting problems showing the GIF image related to a progress bar.

The problem itself is that I can't find the correct path to the image. My folder structure looks like this image:

Image_1: Project Structure

I'm going to give you more details in the next images you can see below:

This image shows you the xhtml fragment related to the path, in this case:

"images/ajaxloadingbar.gif"

You can see the GIF is not properly displayed, and the other code appended is the html generated and presented by Inspect element option of Chrome Web browser.

Image_2: Wrong path first try

I noticed that I achieve my goal removing javax.faces.resource and the last xhtml extension (See 3rd image).

Image_3: Desired Results

Knowing this behavior I tried some variants in the image path and I'm still struggling with this issue. The following are some of those paths I tried without luck.

Image_4: Path not recognized

Unable to find or serve resource, images/ajaxloadingbar.gif.

Unable to find or serve resource, /images/ajaxloadingbar.gif.

Unable to find or serve resource, ../../images/ajaxloadingbar.gif.

Unable to find or serve resource, ../images/ajaxloadingbar.gif.

Unable to find or serve resource, Pack_Encrypt/images/ajaxloadingbar.gif.

Unable to find or serve resource, /Pack_Encrypt/images/ajaxloadingbar.gif.

Unable to find or serve resource, /WebContent/images/ajaxloadingbar.gif.

I really appreciate any help or idea regarding this tricky path. I would like to use a relative path rather than an absolute path.

Kind regards, Luis A.

Community
  • 1
  • 1
Luis Armando
  • 444
  • 1
  • 7
  • 17
  • @BalusC, I made my research before posting my question. I performed some searches like: 1- Primefaces problem with image path 2 - Path image in PrimeFaces (Actually you marked one of those questions as [duplicated](http://stackoverflow.com/questions/30295652/how-to-get-image-through-image-path-in-primefaces-using-grphicaimage-tag). )
    I didn't try with **Facelets Templates** because those terms are completely new to me. Please don't downvote my question because of this. This question can help people unfamiliar with the terms used above.
    – Luis Armando Aug 06 '15 at 15:38
  • 1
    Just learn JSF by Oracle's own Java EE tutorial or a real book. All terms you need to know (and more ..) are covered in there. I didn't downvote, I just closed as duplicate, so the search engine can now find new keywords in your question and associate it with the existing question. – BalusC Aug 06 '15 at 15:40

1 Answers1

3

Move folder "images" into new folder "resources".

Full path should be "...\WebContent\resources\images"

Check out the following page:

What is the JSF resource library for and how should it be used?

Community
  • 1
  • 1
grajsek
  • 856
  • 2
  • 11
  • 24