aspose file tools
The moose likes Servlets and the fly likes Please Wait Window Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply 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: 17228
    
    1

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: 56180
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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: 56180
    
  13

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: 56180
    
  13

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: 56180
    
  13

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: 56180
    
  13

you can create a thread from within a servlet.


You SO do not want to go there!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Please Wait Window
 
Similar Threads
What's the difference between servlet and jsp?
"Please wait ...." message to be displayed
please wait message using javascript
How can i use message window in servlet
New Window