You can not write the response and then sendRedirect(). Otherwise it will throw IllegalStateException.
Doing this means the data has been flushed to the stream and you are calling the sendRedirect().
You could write to the stream without flushing and then calling the sendRedirect() would not cause exception. But it is meaningless.
In your servlet either handle the request or do a sendRedirect() to have someone else handle the request.