Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Intermediate
Apr 28, 2000

'Wait Please...' Implementation

It is a common task for servlet (JSP) developers to have to display something with a server-based operation (calculation) that wastes a lot of time. Suppose you have a very long calculation and need to output some messages to users who are waiting for your servlet's results. Described below is one solution that deploys DHTML for solving this problem:
 
<html> 
<head> 
<style type="text/css"> 
    #waitpage { position: absolute; } 
    #mainpage { position: absolute; visibility: hidden; } 
</style> 

<script language=\"JavaScript\"> 
function init () 
{ 
    if (document.layers) 
    { 
      document.waitpage.visibility = 'hide'; 
      document.mainpage.visibility = 'show'; 
    } 
    else 
    { 
      if (document.all) 
      { 
        document.all.waitpage.style.visibility = 'hidden'; 
        document.all.mainpage.style.visibility = 'visible'; 
      } 
    } 
} 
</script> 
</head> 

<body onLoad="init();"> 

  <DIV ID="waitpage"> 

  <!-- your message is here: --> 
  <center><i> Wait please ... </i></center> 

  </DIV> 

  <!-- your very, very long calculation is here --> 
  <DIV ID="mainpage"> 
    <script language="JavaScript"> 
         location.href='http://your_host/servlet/your_servlet'; 
    </script> 
  </DIV> 

</body> 
</html> 
Dmitry Namiot
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap