2

Lets assume i have next graphic image tag inside a form

<p:lightBox styleClass="imagebox " id="imageLightBox" rendered="true">
   <h:outputLink value="http://..../center/#{myBean.centerId}/picture" title="Bla bla bla">
       <h:graphicImage value="http://..../center/#{myBean.centerId}/picture" />
   </h:outputLink>
</p:lightBox>

and i have next primefaces command button

<p:commandButton icon="fa fa-save" value="Save" title="Save" actionListener="#{myBean.saveCenterImage()}" update="@form" >

So how can i re-render graphicImage when i click on commandButton.

mibrahim.iti
  • 1,928
  • 5
  • 22
  • 50
  • if you're updating the form it should actually be rerendered, most likely you're missing the process="imageLightBox" or process="@form". By the way, I would remove the rendered attribute since it's always true (unless it's like that only for clarity), see https://stackoverflow.com/questions/9010734/why-do-i-need-to-nest-a-component-with-rendered-some-in-another-component-w/ – Mário Fernandes Aug 31 '17 at 06:04
  • @MárioFernandes: process attribute is for what is processed on the server regarding submitted values. You can still update something that is **not** processed. – Kukeltje Aug 31 '17 at 08:48
  • what did you debug? Did you check the ajax response? What does it contain? The same or a new url? Is the browser trying retrieve it? results in a 304? Please explain more – Kukeltje Aug 31 '17 at 08:53
  • @Kukeltje you're totally correct, thanks – Mário Fernandes Aug 31 '17 at 09:41
  • @MárioFernandes yes, rendered=true just for clarification (i am not use it in code) ayway i tried process="imageLightBox" and process="@form" and it doesn't work, i don't know what is the problem, actually i wrote the question so many people think with me and may any one give me a new way to do it for example may using JQuery or pure javascript or what ever (Thanks for ur reply :) ) – mibrahim.iti Aug 31 '17 at 13:38
  • like Kukeltje said, what's the url from the image, what do you get? 304? 404? – Mário Fernandes Aug 31 '17 at 14:14
  • @MárioFernandes i am sure the url is working fine, i just change the image in destination server, but same url still valid, so i am sure no problems at all with image url – mibrahim.iti Aug 31 '17 at 19:05

1 Answers1

3

I think you need to use p:graphicImage instead of h:graphicImage and set the attribute cache=false so that the browser will not cache the image.

Alec Jones
  • 96
  • 9