I have a question,.. ok there is a jsp page and you have some links there which call corresponding servlets. There is also a Log Off button which infact invalidates the session.
A user clicks a link which calls a servlet, and before the response comes to the browser ( When the Servlet java code is STILLrunning in the container), the user clicks the LOg Off button which clears the session , but the servlet code is still running and when it comes across reading any session attributes after the session is cleared, it throws an error which can be looked at the log file.
I know there definitely would be many ways of handling this kind of a problem, but i am just curious to know how everybody handles this???
Well, all that taken care of by your Servlet Container.
Joined: Jun 27, 2005
Hi Sai Krishna Chitta,
Thanks for your response, but eventually when i was testing on my local server - Websphere development studio client (WDSC), i always spot a NullPointerException , when it is continuing with the servlet code.. since the session is already invalidated.
Probably is it some bug/problem with the web container in WDSC??
So actually everybody just relies on the web-container to handle this, right?
Did anybody test in their web Container what is happening if you did that? because as i see, if you click the logOff button, the web container creates another thread and calls the service method (i mean the doGet or doPost) of the log-off servlet, so does it(container) really care, if there is any other request from the same client before for which the response was not flushed or committed yet, so it has to wait until that servlet code finishes and only then this log-off servlet code starts..??
I mean i really doubt this?? atleat the development server is justifying what i am thinking might happen.. The Log-off servlet is not going to wait until the before called servlet finishes execution,.. unless you probably handle it yourself in the code..
I am looking forward to hearing from others too. what they would say??