Please can anyone tell me how i can tell if the remote browser has been closed half-way through the execution of a jsp program. I must be missing something very simple as it is a very important feature of jsp, so could someone please educate this poor peon on this topic.
As far as I know (?), you could not do what you are asking, not unless you were to rewrite your Web server (e.g. Apache), the connector protocol (e.g. mod_jk or AJP), and your J2EE application server or jsp/servlet container (e.g. Tomcat), and even then you might still not be able to get anything in all cases.
Your jsp code, as a servlet, returns the response stream, in a thread of your servlet container engine. This is then sent, over the connector protocol, to a thread of the Web server engine.
I think (?) your jsp/servlet code might, in some cases, even be done returning its whole response, but this might still be buffered up somewhere (e.g. the servlet container, connector protocol stack, Web server engine, TCP stack on server, ...) and only halfway sent to the client, when the client browser closes the connection.