• Post Reply Bookmark Topic Watch Topic
  • New Topic

Freeze browser after clicking link until new page is returned  RSS feed

 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a link in a page that invokes a servlet. This servlet runs for quite a while before returning another page.
How to freeze the first page so that the browser user can’t click any links on this page until the servlet is done and a new page is returned?
Thanks.
 
Byron Estes
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That could be tough and code is probably not going to be pretty.
I suspect you'd need to use javascript and put an onClick event on every possible button push and link click (...and that won't cover using the back button, typing in a new address, etc...)
Just before you went to submit for your long running page, you might update a javascript variable called processing.
The onClick method would be passed in the destination of the "click", but before it did anything it would check the processing flag. If the processing flag was on, then you might pop up a message telling them they can't continue until the process returns or warning them and letting them decide whether to wait or continue with their intended action.
Yuck...
 
Randall Twede
Ranch Hand
Posts: 4690
8
Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think your best bet is to just warn them(somehow) that it will take a while.
 
Aleksey Matiychenko
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may be able to sort of do that by opening up a modal window and see if it is possible to disable a close button through java script.
Just an idea. Don't know if it works.
:roll:
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all.
I will just warm the user for now.
 
Ronald Francis
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's what I do --see if this would work for you..
Use span tags , and set the attribute style to visible /hidden as required. When u submit the form, hide the span . Also, u could display a span with "Please wait ..." text...
 
Mark Stein
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also first go to a jsp page with a message telling of the delay and no other links, that forwards to the servlet.
MS
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!