There is a spring boot server and one page on freemarker - index.flt
On the page there is a button "Generate", which starts the generation of several reports. When you click on it, the controller method is called.
@RequestMapping(value = "/generate/standart", method = RequestMethod.GET) public ModelAndView generate(@RequestParam String name) throws NurException, IOException { ModelAndView index = new ModelAndView("index"); billService.createPdfStandart(name); index.addObject("message", "Success"); return index; } The method calls the service that generates the reports.
Without going into details: the select, which returns, for example, 100 values, is twitching. Based on the values from the select, 100 reports are generated in the loop, which are parameters. It takes a long time, for example, 10 minutes. I click "Generate" - a long process starts and the page in the browser hangs as if loaded.
I want that when I click on the "Generate" button a loader or progress bar will appear that will display the download process.
I do everything in a loop, so I would like to show something like "загрузка 1\100" , then 5\100 99\100 100\100 . That is, at each step in the cycle, update an element with a value on the page or, in extreme cases, an eternal loader for the duration of the process.
I assume that ajax or jquery is required.
Where to find a ready-made solution ( like this ) or information on how to do it?