Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please wait message

 
John Daniel
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My servlet needs to send a message, via MQ, to another platform and wait for a response. This process may take several minutes. Is it possible to display to the user a pop-up message telling them that their request is being processed and to wait? And then when the request is finished, remove the pop-up, and display a completion message?

Thank you,
John Daniel
 
Avinash Ramana
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider AJAX yet? This seems to be a hot thing with the now numerous frameworks.

-Avinash
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Few months back, we had a similar discussion here
 
John Daniel
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Due to the ever shifting priorites from management, I haven't been able to work on this issue again until now. Anyway, this week I started working again on displaying a "please wait" message using Bear Bibeault's advise of a simply displaying a hidden message.

However, not being familiar with JavaScript, I had a hard time figuring out how to do that. So in case someone does a search on this topic, and wants to know how to display a "please wait" message, here's is how I got it to work.

In your JSP, add the following:
<script language="JavaScript">
function displayWait() {
var waitDiv = document.getElementById("wait");
waitDiv.style.display = "inline";
var msgDiv = document.getElementById("message");
msgDiv.style.display = "none";
return true;
}
 
John Daniel
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I submitted my response before I was ready.

Anyway, in my JSP, I added:

<script language="JavaScript">
function displayWait() {
var waitDiv = document.getElementById("wait");
waitDiv.style.display = "inline";
return true;
}
</script>
. . .
<form name="ResetPassword" action="../servlet/whatever"
method="post" onSubmit="return(displayWait());">
. . .
<div class="wait" id="wait">
Your request is being processed, please be patient.
</div>
. . .

And in my CSS file, I added:

div.wait {
width: 39%;
padding: 4px;
display: none;
margin-left: 40px;
color: green;
background-color: white;
}


So what the JavaScript code is doing is simply changing the default display attribute from "none" (don't display) to "inline" (do display).

Hopefully, someone will find this helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic