File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes servlets related question.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlets related question.." Watch "servlets related question.." New topic

servlets related question..

Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85
Hi all,..

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???

Thanks a lot for your response
Sai Krishna Chitta

Joined: Oct 22, 2004
Posts: 12
Well, all that taken care of by your Servlet Container.
Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85
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??

Thanks guys
I agree. Here's the link:
subject: servlets related question..
It's not a secret anymore!