Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > jsp: "Please wait ...."

Reply
Thread Tools

jsp: "Please wait ...."

 
 
Arnie
Guest
Posts: n/a
 
      01-27-2006
I have a Servlet that does an extensive search which may take up to 1-2
minutes to finish. I would like to display a "Please wait ...." page
while the search is being performed and before the search results are
displayed. How can I do this?

thanks

 
Reply With Quote
 
 
 
 
dmcquay@gmail.com
Guest
Posts: n/a
 
      01-27-2006
There may be other options, but here is what came to my mind. The user
is going to click a button/link to begin the search, right? This will
submit the form or whatever. As soon as that button is pushed, the
next page the user will see is the results from the search. There
isn't really a way I know if to add a different page between those two,
but you can use javascript to display a message while the search takes
place. For example, if you are submitting a form...


**** START CODE ****

<script language="javascript">
function doBeforeSubmit()
{
document.getElementById("displayBeforeSubmit").sty le.display =
"none";
document.getElementById("displayAfterSubmit").styl e.dispay =
"block";
return true; // you must return true or the form will not submit
}
</script>

<div id="displayBeforeSubmit">
<form action="results_page.jsp" method="post"
onsubmit="javascript:doBeforeSubmit()">
...
form stuff
...
</form>
</div>

<div id="displayAfterSubmit">
<h3>Searh processing. Please wait...</h3>
</div>


**** END CODE ****


I think this should work unless the browser immediately displays the
new page (results) but leaves that page blank while it waits for the
server to process.

However, I think it would look best to use AJAX (I think that stands
for Asynchronous Javascript and XML). The idea behind this is that you
can use only one page for everything. It's kind of hard to explain,
but really not too hard to implement. If you are interested, let me
know and I will explain.

 
Reply With Quote
 
 
 
 
Andrea Desole
Guest
Posts: n/a
 
      01-27-2006
Arnie wrote:
> I have a Servlet that does an extensive search which may take up to 1-2
> minutes to finish. I would like to display a "Please wait ...." page
> while the search is being performed and before the search results are
> displayed. How can I do this?


I would use a servlet. The servlet could check if the search is
completed. If it's not the servlet would include a jsp with the please
wait message. This jsp should contain a meta refresh tag, pointing to
the same servlet, so that after n seconds the servlet is reloaded.
If the search is completed the servlet can redirect to another page
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RMA'd HD and now A One Month Wait??? werty316 Hardware 48 07-12-2005 10:20 PM
Wait on... VHDL User VHDL 2 08-30-2004 07:36 PM
I Better wait till version 1 Colonel Blip Firefox 7 07-12-2004 10:37 PM
Wait for MS Project to close Taras Pich ASP .Net 4 04-30-2004 04:48 PM
How to make "fork/wait" to WAIT longer? Huey C Programming 1 03-01-2004 02:01 PM



Advertisments