0

Hello all,
I wrote a jsp page. It has a form with a submit button that sends the data to some algorithm.

I would like the submit button to load a "please wait" html.
After the algorithm is done - that "please wait" page will be auto redirected to a result page html.

My problem is that I don't know in advance how long will it take the algorithm to run and redirect the "please wait" page.

Does someone know how it gets done ?
Cheers,

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by javaAddict
0

The best way would be to use AJAX. When you click the submit button display the message "Please wait" in a <div> tag:

<div id="results">
Please Wait for the operation to finish
</div>

using javascript. The submit button will actually be an "AJAX" submit so you will not be redirected to another page. When you are finished, just change the html of that div tag with the results.

0

Thanks,
I can use AJAX in JSP ?

the problem is that the algorithm runs on a remote machine.

So I guess I'll have to use IPC to JSP. right ?
What's the best way to do it?

"When you are finished, just change the html of that div tag with the results. "

How do I do that? (I'm newbie..)

0

"When you are finished, just change the html of that div tag with the results. "

How do I do that? (I'm newbie..)

When the alogorithm at the jsp that you run it finishes, use javascript to change the "innerHTML" attribute if that tag:

document.getElementById("results").innerHTML="";

Or something. I don't remember the exact coding, but you'd better check the w3schools site for javascript tutorials.
Also for the above, I use jquery. It is easier to use AJAX with jquery

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.