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
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.
Joined: Feb 05, 2002
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
Joined: Feb 05, 2002
Hi DOM, Would you please tell me why the form 'auto' has two actions? I'm quite confused. Thanks, Lijun
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.
Customer surveys are for companies who didn't pay proper attention to begin with.