title: Hiding a div element in a JSP when scriptlet has performed
body: <p>If I have a servlet which may take several minutes to produce a response, I want to display a single message on the page saying 'Please wait...'</p>
  
  <p>At the moment I have code:</p>
  
  <pre><code>&lt;div id = "subHeader"&gt;                    
      &lt;%            
          out.flush();
          for (int i = 0; i &lt; 5; i++){
             if (i == 0) {
                 out.print("&lt;h2&gt;Please wait...&lt;/h2&gt;");
                 out.flush();
             }                        
             Thread.sleep(3000);  
          }
          out.flush();
          out.print("&lt;h2&gt;Results of analysis:&lt;/h2&gt;");
      %&gt;            
  &lt;/div&gt; 
  </code></pre>
  
  <p>This prints:</p>
  
  <p><code>&lt;h2&gt;Please wait...&lt;/h2&gt;
   &lt;h2&gt;Results of analysis:&lt;/h2&gt;</code></p>
  
  <p>When the response is pending.</p>
  
  <p>Is it possible to hide the <code>subHeader div</code> so that when the scriptlet has run and the response is made, I only see <code>&lt;h2&gt;Results of analysis:&lt;/h2&gt;</code> and the rest of the page?     </p>