IllegalStateException when response.redirect a jsp page from servlet


I have a servlet when certain condition met, it will be redirected to another jsp page. It did work on localhost:8080, but it did not work when i deploy it on remote server with the same settings and jre


Open in new window

Who is Participating?
javaexpertoConnect With a Mentor Commented:
If you look up sendRedirect() in the API, you'll see that it throws an IllegalStateException if you try to invoke it after "the response has already been committed".
By "committed", they mean that the response has been sent. That just means the data has been flushed to the stream.
For practical purposes, it means you cant write to the response and then call sendRedirect()!

look at this in your servlet code or paste it here so I can help you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.