• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting online users list

 
Subhash Yadav
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am creating a chat application where in I need to create a list of online users. So I have used ServletContext and added a map to it using context.setAttribute() method. this map takes 2 arguments, session.getId() and username (through database). Since I have added this map to ServletContext , it is available to all sessions (please correct me if i am wrong). the overall idea is, when a user log-in he is authenticated and his name and session id is passed as argument to the map and the map is made available to the jsp page (using context.getAttribute). However when I implement this it returns the username and session id of it's only and not of other users who are logged in earlier.
thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have used ServletContext and added a map to it using context.setAttribute() method. this map takes 2 arguments, session.getId() and username (through database).


Are you perhaps creating a new map every time instead of checking for an existing map?

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic