Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying progress when loading JSP

 
Lijun An
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
How do I display progress on the page when a JSP is being loaded? The JSP page will process a lot of data before it is loaded into browser. I'd like to display a progress bar to tell the user to be patient.
Please comment.
Thanks,
Lijun
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with JSPs (and HTTP in general) is there is a clear separation between code on the client server and code on the client.
That is, you cannot generally have code running on each end depending on each other. A request is sent to the server, it processes the request and a response is sent back to the client.
The best way I've encountered to do this is to use an intermediate 'Please Wait' page. Essentially the client sends a request to a 'fake processing servlet', this servlet returns a 'please wait' page and sends the original request to the real processing servlet.
The advantage here is that the 'Please wait' page is the one that is displayed while the long processing takes place.

DOM
 
Lijun An
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, DOM.
I understand that your approach is using a fake process servlet. That's fine. What if the process servlet/JSP is the JSP itself? How do I achieve displaying the progress to the client essentially in the same page?
Regards,
Lijun
 
Lijun An
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi DOM,
Would you please tell me why the form 'auto' has two actions? I'm quite confused.
Thanks,
Lijun
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, cut and paste error...
DOM
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17627
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets and JSPs are expected to turn around rapidly. If they don't the user's browser will time out and the work gets lost. This is why long-running processes should be sent to back-end servers instead of being handled in the JSP code itself. Since HTTP does not support the back-end server volunteering any information, this means that you have to keep polling for information, and the easiest way to do that is by using a timed-refresh web page.
Once the data is complete and in the process of being transmitted back, the webapp is no longer involved. However in some web browsers, the browser itself will show how far along the actual transmission is.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic