• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Flush...

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am inserting a bunch of records into the database and i know it takes a long time to insert. So i want something like wait message(Please wait...) to be viewed by the user rather than viewing just the blank page while its inserting records to the database.
I am using a servlet to do this. So just before the database insert statement i output this message saying (Please wait... ) on to the servletOutputStream and then flushing it.
out.println("Please wait . . .");
out.flush()
Soon after the insert is finished, i wan't that output to be displayed basically saying Num of successful inserts and Num of Error records.
My problem is, it's not outputting this "Please wait ..." message at the start of database inserts at all. This message is output along with the database status.
So my question is how to make this happen? For some reason flush() is not working here.
Any idea???
Appreciate your help,
Thanks.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a few ideas:
1) When the request for the information is made, direct the request to a page that contains your "please wait..." message which in turn makes the actual request that will display the info. This way, while the info is being gathered, the intermediary page is being displayed.
2) An IE-only solution that I've used in the past when I knew that the web app was going to be used in an IE-only environment is a bit more complex and relies upon the page being a JSP.
I created a DIV with its display style initially set to visible. The visual style of this div made it look like a message box on the screen. The actual info was included into this page using a jsp:include directive. Once the included sub-page loaded, it invoked a javascript method that set the display mode of the "box" to invisible.
The effect is that the box would display immediately, and stay visible while the "sub-page" was loading. Once the sub-page loads, the "box" disappears.
This solution may be too fragile for general use. It relies upon IE-only capabilites (or at least Netscape 4.x can't change the page dynamically like this), and it relies upon the response output getting flushed to the browser before processing the jsp:include for the sub-page.
It worked fine in the environment in which it was deployed (controlled in-house web app, caucho resin container), but I'm not sure if I'd rely upon it in a broader environment. But I figured I'd relay this in case it's something you want to play with.
hth,
bear
[ April 08, 2002: Message edited by: Bear Bibeault ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about sending your "Please wait..." with some HTML markup so the browser will know what to do with it? Like "<p>Please wait....</p>
Bill
 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply. It works fine now. I just did what William Brogden said.
Thanks again for your reply.
 
What are you saying? I thought you said that Santa gave you that. And this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic