I have the following code:
// part of the doPost(...) section of a servlet
response.sendRedirect("someurl");
RequestDispatcher view = servletContext.getRequestDispatcher("/someFile.jsp");
view.forward(request, response);
I would like the browser to redirect, but if for some reason the browser doesn't redirect should display a page indicating where the user should go. However, trying the above code does not work and gives me an exception:
java.lang.IllegalStateException: Cannot forward after response has been committed
1. Any idea's on how I can achieve this?
2. Is there any chance at all that the redirect might not happen on the browser end?