0

I have a JSF button (in PrimeFaces)

<h:commandButton value="Download Report" action="#mybean.downloadReport}" 
                        disabled="#{mybean.processing}" styleClass="buttons" />

At the very beginning, mybean.processing is true so the 'download' button is disabled. After a while processing finishes so the button should be 'enabled' So I need a mechanism to periodically check the bean status to refresh the UI.

I know p:poll works but that requires an explicit ajax, is there any other way to do it?

rhbc73
  • 739
  • 9
  • 24
  • Sure, use push (websockets) – Kukeltje Sep 05 '19 at 05:40
  • @Kukeltje He can use a binding and just setDisabled false when he needs it ;), or bind the disabled value to a boolean he can manipulate – BugsForBreakfast Sep 05 '19 at 13:06
  • @BugsForBreakfast: No, you cannot do this from the server side when there is no request initiated from the client and with poll you could (but you don't need to) if you have lots of binding still in your application, you have a (too) tight coupling between ui and 'model' – Kukeltje Sep 05 '19 at 14:37
  • Hi, I'm very new to JSF/JEE. But in my case, backend bean sends an async request so it has a Future<>. It doesn't have a callback so it doesn't know when the response is back. So there's no way for backend to update front end. – rhbc73 Sep 05 '19 at 23:15

0 Answers0