1
<h:commandButton value="A"   action="#{juegoService.ingresarPalabra('A')}">

</h:commandButton>

I'm using JSF 2.0, and I have a button like the above, for each letter of the alphabet that call a method that load an image on the page, depending the word you press will load the corresponding image, but I need to call the method without reloading the page because I can only have loaded one image on the page, because when I click other the page reloads the Bean and the other image returns to the first state thats its not charged.

lexicore
  • 42,748
  • 17
  • 132
  • 221
Disa
  • 45
  • 6

1 Answers1

1

You should use f:ajax and refresh container with image.

    <h:commandButton value="A with AJAX" id="button" action="#{juegoService.ingresarPalabra('A')}" >
      <f:ajax execute="@this" render="containerId" />
    </h:commandButton>
robson
  • 1,623
  • 8
  • 28
  • 43