Somewhere in your code you have committed some response to the response object.
You have to dispatch to your jsp
page before you commit any output to the response object
.
From the Documentation
forward should be called before the response has been committed to the client (before response body output has been flushed). If the response already has been committed, this method throws an IllegalStateException. Uncommitted output in the response buffer is automatically cleared before the forward.
The problem is that you are forwarding to the admin.jsp page when you should be redirecting in the Utils.CheckSession
method
request.getRequestDispatcher("Admin.jsp").forward(request, response);
Should be
response.sendRedirect("Admin.jsp");
return false;
// in the doGet method
if (!Utils.CheckSession(request,response)) {
return;
}
Redirects do not happen immediately, the servlet
will continue execution and when it hits the next RequestDispatcher.forward
call the exception
is raised.
The server needs to send the http: redirect status code in the http response, the browser then receives the response and requests resource specified by the redirect url.