I have a servlet that processes an order and forwards (with the RequestDispatcher's forward() method) to either an error page jsp or order confirmation jsp. All of the code is working perfectly except for one thing -- if the user refreshes the page, the form data is re-submitted to the servlet. Is there any way to prevent this annoying behavior?
Make the JSP POST to a processing servlet, then use a sendRedirect to the confirmation page.
Joined: Feb 18, 2004
Thanks, that does work. I guess I avoided it because some JSP/Servlet books advise against using sendRedirect() in favor of forward() because the user won't see the page in the URL and can't bookmark it. I think the problem with a refresh resubmitting the form is a more serious problem than a user trying to bookmark the page.