0

I am having weird problem with displaying images on my JSF application. They're not visible after page is rendered first time, but after at least one refresh they're visible.

I've developed images upload feature, and I'm saving uploaded images to

web\resources\files\

directory located under my JSF project.

Here's my view code, which should display for each uploaded file thumbnail with hyperlink to it. (festivalViaFile.images is my String array with images name with extensions saved during previous upload phase)

<p:lightBox styleClass="imagebox" id="lighbox1">  
    <ui:repeat value="#{festivalViaFile.images}" var="image">
        <h:outputLink value="resources/files/#{image}" title="#{festivalViaFile.festival.name}">                                           
            <h:graphicImage library="files" name="#{image}" style="height: 120px; width: 180px; margin: 5px; box-shadow: 2px 2px 2px #888888" />  
        </h:outputLink>
    </ui:repeat>
</p:lightBox>

When I open developer tools, Chrome gives me this as image code:

<img id="j_idt60:0:j_idt62" src="RES_NOT_FOUND" alt="" style="height:
120px; width: 180px; margin: 5px; box-shadow: 2px 2px 2px #888888">

After refreshing page it looks like:

<img id="j_idt60:0:j_idt62" src="/piaproject/faces/javax.faces.resource/1487053141410.jpeg?ln=files" alt="" style="height: 120px; width: 180px; margin: 5px; box-shadow: 2px 2px 2px #888888">

Feel free to request any additional information.

SOLVED: Uploaded image only available after refreshing the page

Change glassfish's xml file and change upload desination. Full post in link provided.

Community
  • 1
  • 1
ldragicevic
  • 621
  • 4
  • 11
  • 22

0 Answers0