Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

jsp: "Please wait ...."

Thread view: 
Arnie - 27 Jan 2006 15:14 GMT
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
dmcquay@gmail.com - 27 Jan 2006 16:11 GMT
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").style.display =
"none";
   document.getElementById("displayAfterSubmit").style.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.
Andrea Desole - 27 Jan 2006 16:32 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.