0

I have a usecase where there will be a webservice call in the backend when clicked on a button. I have used p:commandbutton.If the web service call is successful then I need to display an overlaypanel with a message and if not successful, I need to show an error message. The necessary web service call is invoked from the button click. But how to capture the response if it is successful or not, and then display either the overlaypanel Or error message based on the response.

Is there any way to capture the response in the xhtml after the action invoked through actionListener ajax command button.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Pavan Ghantasala
  • 209
  • 1
  • 4
  • 13
  • 1
    Which pf version are you using? Your ws (rest/soap/...?) is executed asynchronously? If that's the case you can check [this](https://www.primefaces.org/primefaces-push-2-0/) for older pf version, or otherwise [this](https://stackoverflow.com/questions/3787514/how-can-server-push-asynchronous-changes-to-a-html-page-created-by-jsf/49852105#49852105); else you can just run some javascript server-side, something like explaned [here](https://dev.to/daviddalbusco/trick-javaserver-faces-load-your-bean-data-from-the-client-side-5al9) – WoAiNii Mar 31 '20 at 20:29
  • .. or simply set a Faces message and indicate validation has failed: https://stackoverflow.com/questions/14401652/how-to-trigger-args-validationfailed-in-primefaces-oncomplete – Jasper de Vries Apr 01 '20 at 07:36

0 Answers0