0

I am trying to access to a controller when clicking on a button. The fact is, i need to change the url of the button dynamically.

<p:button styleClass="btn-openHtml" href="#{data.htmlRenderUrl}" value="button html" target="_blank"></p:button>

The href property isn't updated when my bean's property changes. How can i make it so the value of href is updated when data.htmlRenderUrl is changed?

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102

1 Answers1

0

you have to update the button with ajax. when you update the property in your bean:

...
htmlRenderUrl = "/home";
//update your button
PrimeFaces.current().ajax().update("button-id");
...
Blablabla
  • 127
  • 1
  • 1
  • 8