HTTP is strictly request/response, so it's not a good idea to try to play games of that sort. A long-running process under a
servlet will simply not return until the process is done and a thread spawned but not tracked will get lost.
What you can do is create a background thread and store it in your session, then set up the page to use the refresh meta-tag to poll the server periodically to see if the thread is finished.
This is a moderately complex task (usually takes me a day or so of coding to get going), so rather than explain in detail (and forget critical things), I'd recommend you search through similar messages in this forum and especially in the servlets forum.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.