How to change an image using the commandButton in Java JSF?

0

0 vote against favorite Good afternoon, I'm developing a naval battle game in JAVA using Primefaces to make the front end. I would like a help to mount a commandButton that when clicked, trigger a function that will return if the house selected by the user is empty or not, if not what ship is allocated there and then replace the image that has in that commandButton by the image of the ship .

<h:commandButton image="/resources/images/agua.png" style="width:100%"/>

The greatest difficulty would be to exchange one image for another, we have already used EL in this way:

<h:commandButton image="#{navioBean.imagem}" style="width:100%"/>

But the button does not find the image, the button exists but the image does not load.

    
asked by anonymous 17.06.2018 / 16:55

0 answers