-
Theory Inquiry
Community,
If there are any gurus out there paying attention, maybe you can help me out?
Lets say on a .jsp page, I have a button, which when clicked transfers the user to another .jsp page.
While on the server, this 2nd jsp file starts executing a server side method (which could take a long time, and have many algorithms and calculations).
My question is: would it be possible to somehow, while this long method is being executed, to relay messages back to a jsp page which would act as a logger. So, as the method is executing, the user would see a line by line log entry of the results/status of the method being run server side IN REAL TIME; not just a list of log entries returned AFTER the method is finished executing.
Tried searching google, but without knowing what terminology properly describes the functionality I'm looking for, looking through all the search results is quite frankly futile.
Anyone have any ideas?
Brainstorming quite welcome, and any input would be appreciated.
Thanks in advance.
-
Re: Theory Inquiry
I was able to solve this problem using an older methodology of providing a .jsp page with a progress bar.
By creating a java class that implements both Runnable and Serializable, you can create a function that is able to run on a seperate thread, and provide static messages and percentage of completion to a .jsp page that refreshes itself on a defined interval, thereby accessing updated messages and percentages from the object.
Although, I did initially want a logger style functionality for the .jsp page, where all the status messages are logged in succession so the user can read them as they are populated, the functionality described above will suffice for the time being.
-
Re: Theory Inquiry
You could also solve this by using AJAX which calls a servlet which provides the progress data which you then can use to render the progress bar.
Another very cool way would be to use DWR - Easy Ajax for JAVA or Comet and have the web server push back the data to the JSP page in real time without having the browser refresh the page or use AJAX to call a servlet :D
// Json