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...'
At the moment I have code:
<div id = "subHeader">
<%
out.flush();
for (int i = 0; i < 5; i++){
if (i == 0) {
out.print("<h2>Please wait...</h2>");
out.flush();
}
Thread.sleep(3000);
}
out.flush();
out.print("<h2>Results of analysis:</h2>");
%>
</div>
This prints:
<h2>Please wait...</h2>
<h2>Results of analysis:</h2>
When the response is pending.
Is it possible to hide the subHeader div
so that when the scriptlet has run and the response is made, I only see <h2>Results of analysis:</h2>
and the rest of the page?