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,

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.

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..)

"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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.