简体   繁体   中英

How to show progress of threads on the JSP page using Spring MVC?

I have a Spring MVC Webapplication, there is one form from which I am taking some input,based on those inputs, I am creating one unique id (by checking it in the database,logic in Java side not database for creating unique id). Everything is fine till now.

Now I want to give a bulk upload option through CSV file. I parsed whole data from csv file and I tried to insert data (8000 records) in the database using TaskExecutionService. But still this whole process is not much fast that I get a immediate response, so I want to show the progress of whole task on jsp page , so that It looks interactive and also on completion of all threads, I want to display a link to download csv file with all the unique ids.

I don't know how to update page as threads are running behind the scenes?

Any other approach for this process is also welcome, if compatible with spring MVC.

This can be done using ajax, where you can poll the progress percentage from your back end and use js/jquery or other plugins to show the progress.Any how you have to design the logic to get the percentage of work done by your threads.May be you can count the number of rows inserted and get a logic out of it to calculate the percentage of work done. so there should be a method which returns the % of work done and ajax calls to this method can help to display the progress.

refer jquery progress bar

Progressbar.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM