HttpSession session = req.getSession(true);
Later on one of my other servlet i try and access the accesslevel but it only returns null. what can it be?
the code in the class that want to access the session is as follows: HttpSession session = req.getSession(false);
String access = (String) session.getAttribute("access");
Originally posted by Frank Carver:
How are you getting the session in your servlet? Beware that you can get a session in two ways, one which always creates a new session, and one which will get an existing one if it is present.
Do other values go inand out of the session OK?
Yes the values go into the session, but when I access them in the other class they return null. I do use getSession(true) and getSession(false) in the right palces to prevent creating a new servlet each time.