Java Ajax显示进度

I have a jsp page that calls a servlet when a drop down list with a bunch of different form names. If the user chooses to generate all forms the servlet then calls a java file that contains a loop. that runs each report generation one at a time. The whole process for this takes about 7 minutes as these are very large reports.

My question is, with keeping the same process (jsp -> servlet -> java code), can I get the progress status using ajax? What I want to do is find out what iteration the loop is on, find out if the function that writes the data out to excel (which is the format of all forms) has started, and write this information to the screen for the user to see so they are not guessing what is happening at any given time.

Additionally, we currently print out all this information to the console in eclipse so that for testing we can atleast know it is working. I am not sure if that matters.

Edit: I can provide code if needed but really the jsp contains a drop down list, the servlet takes that list and gets the value of the option selected (aka report1, report2, report 20...) and sends that value to the java code as a string. The java fucntion that is called is ReportAutomator.start(String reportNum){for loop here}. The for loop calls various functions to generate a report object which is forwarded onto a new java file that does more processing and then again forwarded to a final java file that unpacks the object and writes all the information to excel.

I am not really able to provide the actual code but I can try and make a dummy example if necessary. Sorry, and thank you for the help.

Determining the progress of a particular task is a surprisingly complicated thing once you get into the details however there is a jquery with ajax to update progress bar.

For a web app i recommend AJAX route it is suitable to indicate to the user the something is happening. Just have a spinner of some sort made visible when the page is submitted, and then hidden again when it is rendered