Friday, March 13, 2009

Response has already been commited error. What does it mean (JSP)

Question :Response has already been commited error. What does it mean? (JSP)

Answer :This error show only when you try to redirect a page after you already

have written something in your page. This happens because HTTP

specification force the header to be set up before the lay out of the page

can be shown (to make sure of how it should be displayed...contenttype="

text/html" or "text/xml" or "plain-text" or "image/jpg", etc...) When

you try to send a redirect status (Number is line_status_402), your HTTP

server cannot send it right now if it hasn't finished to set up the header. If

not starter to set up the header, there are no problems, but if it 's already

begin to set up the header, then your HTTP server expects these headers to

be finished setting up and it cannot be the case if the stream of the page is

not over... In this last case it's like you have a file started with
Tag> some output (like testing your

variables...) ... and before you indicate that the file is over (and before the

size of the page can be setted up in the header), you try to send a redirect

status... It s simply impossible due to the specification of HTTP 1.0 and 1.1



No comments: