Implementing progress message

In my module I am processing a large textfile and I would like to show the progress in percent.

Therefore I set auto refresh in my jsp file to 5 second using response.setIntHeader(“Refresh”, 5). And in my controller function I am setting a session variable to the respective percentage value using httpSession.setAttribute(“import_status”, percentage_val). Unfortunately it does not work. It shows the percentage only, when the processing ended. It looks like the jsp file is not autorefreshing anymore once the form is submitted. How do I update elements in the jsp file while the servlet is processing the file?

Does the initial request spawn off something like a thread and then immediately returns? Just for the sake of mentioning, this module’s jsp uses a different approach: http://svn.openmrs.org/openmrs-modules/databasebackup/web/module/backupForm.jsp