This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please Wait Window

 
Fred Sanford
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kitty Dayal
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That will just put an artificial delay of 5 seconds into the mix. What's the point of that?
 
Sebastian Hennebrueder
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Kitty Dayal
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can create a thread from within a servlet.


You SO do not want to go there!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic