问题
I have a Java web application that performs a long running task via a struts action. I would like to display a progress bar for the task and would like to update the progress bar via AJAX which calls some action to get the current progress of the running thread.
What is the best practice for accomplishing this? If action A executes the FutureTask thread, how do I access this FutureTask object from another action to get its current progress? Is this even possible or is there a better approach to this problem?
Any help would be greatly appreciated.
Thanks!
回答1:
Put the FutureTask or the Callable in the Session and then pull it out in the other action to check the progress.
来源:https://stackoverflow.com/questions/7474080/java-web-app-futuretask-progress-bar