wood burning stoves 2.0*
The moose likes Servlets and the fly likes Please Wait Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Please Wait Window" Watch "Please Wait Window" New topic
Author

Please Wait Window

Fred Sanford
Greenhorn

Joined: Sep 09, 2004
Posts: 1
Have form on a jsp. Click submit and forwarded to a servlet. This servlet performs validations and inserts/updates to database. The servlet redirects to a "thank you" jsp when done.

Is there a way to display a small "please wait" window while the servlet is processing and kill the window when i need to display the "thank you" jsp?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I believe you display the please wait window, then have that page forward to your actual Servlet. That way the window is displayed, ans stays displayed until the actual Servlet displays.

But this is a guess.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Another technique, which I've used with great success on modern browsers, is to have a hidden floating div with the 'please wait' message. Just before submitting the form, cause the div to display. It hangs around until the browser is ready to start painting the response.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kitty Dayal
Ranch Hand

Joined: Jul 22, 2004
Posts: 89
Hey Bear,

Can u elaborate on your floating div. I did not quite get it. Is it on the same browser OR is it a new window.

Thanks
-Kits
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

It's an HTML/CSS/Javascript trick. Using CSS set the z-index of the div to make it float, give it an absolute position, and assign its display attribute to none. To make it appear, set the display to 'block'.

Further discussion of CSS should probably take place in the HTML/Javascript forum.
Jay Ashar
Ranch Hand

Joined: Oct 13, 2002
Posts: 208
use this

<meta http-equiv="Refresh" content="5; URL=destination.jsp">

in between <HEAD></HEAD>
After this use <BODY></BODY> to display your please wait images.
This will run please wait for 5 seconds and then forward the request to destination.jsp.


SCJP 1.4<br />SCWCD 1.3
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

That will just put an artificial delay of 5 seconds into the mix. What's the point of that?
Sebastian Hennebrueder
Ranch Hand

Joined: Sep 09, 2004
Posts: 49
I am not sure if you can create a thread from within a servlet.

If it is possible

create a status servlet which
a)
looks for the status in the db or a singleton class.
b)
starts the actual working process.

Sebastian


Things get always more complicated as expected.<br />Author of eBook Hibernate 3 Developer Guide by example<br />Tutorials about Hibernate, EJB, Struts, JSF <a href="http://www.laliluna.de" target="_blank" rel="nofollow">www.laliluna.de</a>
Kitty Dayal
Ranch Hand

Joined: Jul 22, 2004
Posts: 89
Hey Bear,

Doesn't a small javascript code can do that? u know just use simplest window.open() with some text and close it after the other servlet loads OR if you r too busy leave it as a pop-up( I know the latter is not good).

- Thanks
Kits
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

I would not use window.open(). It's too slow (loads another page), too disruptive, and too disconnected from the original page.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

you can create a thread from within a servlet.


You SO do not want to go there!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please Wait Window
 
Similar Threads
"Please wait ...." message to be displayed
How can i use message window in servlet
What's the difference between servlet and jsp?
please wait message using javascript
New Window