Without JSP generating a "Content-Length" header in response to a POST operation to a .jsp file, how do browsers know when HTML transmission (i.e. dynamic content) is done? I'm having issues with "half-pages" being sent to the browser. It works fine over a local network, but over the internet we have issues because of network latency.

Serge Knystautas

Unless you are flushing the output of your JSP, or creating pages that exceed the buffer, your servlet engine should handle putting a Content-Length header on your response. You can try increasing the buffer of your page so that the servlet engine can complete generation of the page before beginning transmitting (and can then know the content-length). It's nearly impossible for a JSP (in particular) to know its own content-length as the amount of whitespace can vary between JSP compilation engines.

In HTTP, if the Content-Length is not specified, the connection must be closed at the end of the response, and in fact, this signals the end of the response. This limits the browser and server's ability to use Keep-Alive connections, so whenever possible, the web server will try to prevent this. That said, if you are having network latency issues leave you with half open pages, what I guess is happening is that no content-length is specified (because you are flushing output or the page is larger than the page buffer) and then the connection is timed out after too much network latency.