How to forcibly create a new session in Java Servlets
问题 I am storing session ids in database at log in time. The problem I am facing is that if a different user logs in after first one, same session is entered in DB and welcome username still reflects the name of the one who logged in first on the same machine. I want to create a new session id each time a user logs in, but somehow my code doesn't work. HttpSession session = request.getSession(); String sessionID; request.getSession(true); sessionID = session.getId(); Note: the above code is