I have a simple servlet that creates a HttpSession, the class is below. My question is this. If I open my browser and the html page calls the servlet, the servlet creates a session and adds a cookie with the session ID. I close my browser, open a new browser and call my servlet again, however the servlet creates a new session and new session ID. Is this normal? I was sort of under the impression that if you opened a new servlet, and that servlet called request.getSession(), the existing(original) session would be found. Please clarify if possible.
The cookies used here, are session cookies, and these die together with your browser instance. It is very unusual to have a session that survives a re-opening of the browser. If you want to do that you might consider the use of a "real" cookie that contains the uniqie id you get from [session].getId().
To revitalize the session you could do a first connect to the servlet, this will read the cookie and redirect you to the servlet for a second time using the URL plus the sessionID in the form of