how to store jsp session data of different user in java.util.hashmap
and access the data of all user on the server side
The same example is given in professional jsp but its not working.
I can use getIds() of httpsessioncontext but it's depricated
i dunno what you're trying to achieve exactly, but here's a rough thing you can do...
in the servlet (or JSP) that will actually store the 'session data'
// here's what i'd do, but i dunno what you really want
// in a JSP, you can use application.getAttribute("users");
ServletContext sc = getServletConfig().getServletContext();
Map users = sc.getAttribute("users");
if (users == null)
users = new Hashmap(); // I guess this is the first user
users.put(session.getId(), object); // or whatever you're putting
sc.setAttribute("users", users); // store it back
I'm sure this isn't what you're doing, but maybe it can serve as a hint? Basically you're storing a hashmap in application scope.
Remember your scopes:
page < request < session < application
If you want one to track the other, then use a higher level scope. Since you want to track sessions, you'll probably want to use something with application scope. Sorry for the bad explanation, but I don't have much to go on :D