I have a simple thymeleaf form with a drop down as report type and a button to generate the selected report. I need to provide the Save As/Open window of the browser, so the user can see the report.
The result of the report execution could be
A/ the report itself. In this case I need to provide a HttpServletResponse.
B/ the report is empty. In this case I need to reload the view with a Model attribute showing a message to the user.
C/ any kind of error during report generation. In this case I log the error, and reload the view with slightly different message informing the user about the issue. This is also managed with Model attribute.
While the report is generating I hide the Generate button and show a progress bar.
As of now I make form submission. It works well, when there is B or C. But in A I don't know how to catch up that the submission is finished. So, I can show the button and hide the progress bar.