Hi, I want to run a specific(rename the files that he has accesed on my server)action at both the instances -- either the user logs out or he/she shuts down the browser directly without loggingout.Its no problem whenever the user logs out properly bcoz that time i can run my servlet.However what if the user does not logout and closes the browser directly. Any suggestions as to when should i run the servlet -- One solution i can think of is i can run the servlet maybe after every 20 mins.But then if i use this method then how do i invoke it every 20 mins.I am using Tomcat v 3.2. 1.Also is it an optimal solution??? 2.Will it not increase load on the server-----Renaming few files every 20 mins.???
That's about the most commonly asked question in this forum - click on "search" and see what others have said. As far as running a servlet on a timed basis, that's not to be expected on ANY platform. Servlets are run in response to HTTP requests. You can have a task send an HTTP request periodically, but without receiving an HTTP request, a servlet doesn't run (startup code doesn't count). The idea of trying to do something when a user "exits the application" just doesn't work on a web server. Aside from the fundamental architectural differences, web clients often "exit" by crashing (TOO often ). Try getting an event from THAT! This is why modern servlet/JSP servers have support for session timeouts.
An IDE is no substitute for an Intelligent Developer.