Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"Please wait...processing request" window

843836Sep 13 2004 — edited Aug 5 2008
FYI...

There is a neat way to display a "Please wait...processing request" message while the user waits for the system. It's really straightforward and only takes a few lines of code.


Place your form inside of <div></div> tags
Place the code for the "Please wait..." message inside of <div></div> tags
When the jsp is loaded, the tags are defined so that only the code inside the first div tags is displayed - user only sees the form
When the submit button is clicked, a javascript function is called.
The javascript hides the code inside the first div tag (form goes away) and displays the code in the second div tag - "Please wait..." message is displayed
Then the javascript calls submitForm() so that the servlet is called and processing begins
When the servlet is done, he forwards the client to another jsp (Change Verification, Thank You, whatever) and the "Please wait..." message is replaced.


The "Please wait..." message will appear instantly
Lets the customer know that the system is doing something
Since the form is hidden, user cannot hit the submit button twice
There are lots of possibilities with hiding/displaying code.
It can be used on button click, hyperlink click, etc.


Sample jsp:
<html>
<head>
<title>Company Profile</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="shared/estyles.css" type="text/css"> 
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<div id="formDiv">
<form action="submitCompanyProfileServlet" method="POST" name="COMPANY">
<!-- YOUR FORM GOES HERE -->
</form>
</div>

<div id="pleaseWaitDiv" style="display: none;">
<jsp:include page="pleaseWait.jsp"/>
</div>

<script type="text/javascript">

function submitForm(oForm)
{
  // Hide the code in first div tag
  document.getElementById('formDiv').style.display = 'none';

  // Display code in second div tag
  document.getElementById('pleaseWaitDiv').style.display = 'block';

  oForm.submit();
}

</script>
</body>
</html>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2008
Added on Sep 13 2004
14 comments
2,356 views