Response has aready been committed

Firstly, the problem is not in the JSP or JS in your example1. The problem is in what your servlet does when it gets the “…/abcHandler.do?operation=view;” request.

The problem is that you are trying to do stuff that would require a change to the HTTP response headers … after the headers have been sent. That is what the exception / message is saying. (A response is “committed” once the servlet framework starts writing the response. That is typically triggered when something opens the servlet output stream / writer … in preparation to writing the response body.)

To give you a proper diagnosis, and sensible advice on how to fix the specific problem here, we need to see the Servlet / JSP code that is handling the above request.

The “url illegally evaluated to null” message is a bit hard to place. It could be happening before the IllegalStateException … or after it.

(One possibility is that your JSP code is trying to do something with some ‘url’ attribute that is unexpectedly null, that is triggering an exception. Then the container’s error handler is trying to set a different response status … and that is failing because the response is already committed.)

In summary, it is not possible to figure out what the root problem is without more information; i.e. the code.


1 – Actually, you are missing a closing quote for the url initialization … but I assume that’s just a transcription error.

Leave a Comment