0

In a JSF application, which also uses PrimeFaces, when a command link is clicked, the page navigates to another JSF page after performing some action which takes about 30 seconds. Until the destination page is loaded, there is no way to convey the message for the user to wait for a few seconds. So the users keep on clicking the command link again. Is there any way to display a message or an icon stating that the page navigation is underway and ask to wait until the navigation is completed.

Kukeltje
  • 11,924
  • 4
  • 19
  • 44
Buddhika Ariyaratne
  • 1,902
  • 3
  • 44
  • 79
  • 2
    Maybe p:blockui might give appropriate feedback and prevent triggering multiple expansiv actions. Also performing the action asynchronously using AJAX is worth thinking about. – Selaron Oct 09 '19 at 14:39
  • It works with ajax requests. The navigation, in this case, is to completely to a different page. – Buddhika Ariyaratne Oct 09 '19 at 14:45
  • Actually It worked perfectly. I used ajax command with update="@all". If you add this as an answer, I can accept. Thank you so much. – Buddhika Ariyaratne Oct 09 '19 at 14:58
  • 1
    what is the usecase for something taking 30 seconds? Maybe there is a completely different approach possible. – Kukeltje Oct 09 '19 at 17:45
  • 1
    You can try ajaxStatus https://www.primefaces.org/showcase/ui/ajax/status.xhtml which is basically a dialog that will appear while the action is performing :) you can set modal true so user can't trigger other stuff while it is showing. – BugsForBreakfast Oct 09 '19 at 18:12
  • 1
    Feel free to post an answer on your own question, that's ok. Possibly [How to run a background task in a servlet based web application?](https://stackoverflow.com/questions/4691132/how-to-run-a-background-task-in-a-servlet-based-web-application) is interesting for you. Here is a duplicate candidate: [How to do double-click prevention in JSF 2](https://stackoverflow.com/questions/10756426/how-to-do-double-click-prevention-in-jsf-2) – Selaron Oct 09 '19 at 18:31

0 Answers0