Invalidating the existing session and creating new session in servlets

In other words, servlets have built in session tracking.[2] [2] Yes, we do feel a little like the third grade teacher who taught you all the steps of long division, only to reveal later how you could use a calculator to do the same thing.But we believe, as your teacher probably did, that you better understand the concepts after first learning the traditional approach.

The level of support, however, depends on the server.Fortunately for us servlet developers, it's not always necessary for a servlet to manage its own sessions using the techniques we have just discussed.The Servlet API provides several methods and classes specifically designed to handle session tracking on behalf of servlets.All URLs emitted by a servlet should be run through this method.This method encodes (rewrites) the specified URL to include the session ID and returns the new URL, or, if encoding is not needed or not supported, it leaves the URL unchanged.

Leave a Reply