I am writing a
servlet to perform a financial transaction. I can re-write it as several related servlets if necessary. Rather than bog down on details, I will explain what I want to accomplish, and the experienced among you will be able to advise me on how to approach this.
A doPost calls my servlet, sending it about 20 parameters. The servlet checks to make certain that the parameters are valid. If they are not, it sends a response, advising the user what is wrong, and allows for a back page to fix the errant items. All this works. My problem arise once the servlet is satisfied with the parameters, and gets down to executing the business logic.
What I want to do is display a "Please wait, we are processing your request" web page while my servlet is chugging away. After the servlet has finished, I want to display a page "Transaction is completed, print this for your records". I want the Transaction Completed page to replace the Please Wait page, but I could live with Transaction Completed appearing in a separate tab or window.
I have experimented with various forms of flush, response.setHeader(Refresh), RequestDispatcher, and redirect, but nothing quite works the way that I want it. I would prefer to avoid Javascript, but I would do it if I must.
I don't think that I need detailed code at this point. I think that I need general guidance. This is a common web transaction. I must be missing something in the bigger picture.
Thanks to all who respond,
Josef