wood burning stoves 2.0*
The moose likes JSP and the fly likes Display appliaction processing status msg in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Display appliaction processing status msg in JSP" Watch "Display appliaction processing status msg in JSP" New topic
Author

Display appliaction processing status msg in JSP

Gerome Kawa
Ranch Hand

Joined: Dec 05, 2002
Posts: 61
Hi
I have a JSP page with a button which when clicked does enormous processing at the back-end and takes around 10 minutes to complete. I want to provide the users some status update messages of what happening in the JSP.
Can anyone point to some sample application/design/code samples ideas of how to go ahead ?

Thanks
Kawa
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

10 minutes is way too long for a synchronous operation. The browser is likely to time out long before that.

Best to perform such long operations as background threads or in a separate daemon and give the users a means to monitor the progress of the operation.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gerome Kawa
Ranch Hand

Joined: Dec 05, 2002
Posts: 61
Actually it is an existing application and I cannot change the existing mechanism. What I need is to some way display display some user friendly message which refreshes intermittently about the processing which is happening at the backend. The backend processing happens in three stages and I want to display the user different messages as each stage starts.
Please let me know if you have any idea.

Thanks
Kawa
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The standard way to do this is to kick off the long running process in another thread or process and return immediately to a polling status page.

The long running process can write to a database field, a file, or a scoped variable with the status of it's progress.
The polling page refreshes every n seconds, checking the progress (where ever the long running process writes it) with each iteration.
[ April 13, 2005: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Gerome Kawa
Ranch Hand

Joined: Dec 05, 2002
Posts: 61
Hi Ben
Can you please tell me some URLs where I can find som sample code/workign application for such a mechanism. I am not that great in coding so need some help to start writing it and then I can take it from there.
Thanks
Kawa
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I don't know of any example sites for this pattern.

Describe your long running process. Is it a Java method or is it in a database tier?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Someone just posted this example in the servlets forum (Thanks Annie)
http://www.onjava.com/pub/a/onjava/2003/06/11/jsp_progressbars.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display appliaction processing status msg in JSP