*
The moose likes Servlets and the fly likes Please wait message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Please wait message" Watch "Please wait message" New topic
Author

Please wait message

John Daniel
Greenhorn

Joined: Mar 27, 2005
Posts: 20
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

Joined: Jul 31, 2006
Posts: 11
Consider AJAX yet? This seems to be a hot thing with the now numerous frameworks.

-Avinash


J2EE programmer for JTG..
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10067
    
163

Few months back, we had a similar discussion here


[My Blog] [JavaRanch Journal]
John Daniel
Greenhorn

Joined: Mar 27, 2005
Posts: 20
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

Joined: Mar 27, 2005
Posts: 20
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.
 
Consider Paul's rocket mass heater.
 
subject: Please wait message