• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Log in problems using Jsp,Srvlet and Beans

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm doing a page with Jsp,Servlet and Bean to allow entering in my site only to registered users. I decided to use session and to give a session to every new registered user logged in my site. To prevent the collision of two people with the same user at the same time I used a field called P in my user database; the P record associates to the user logged is set to 1. Everytime everybody tries to use the same user, a check method read a P=1 and stop him. When a user logouts the his P is reset; also when the browser is closed (without logging out) I used a JavaScript to grab the event and to reset the proper P. But when the session is invalidated due to time out how can I grab the user name for that session and put his P to 0? I decided to use a timer so that after 5 hours the P is however reset and the user is logged out but I don't think is good; in fact for example if the client crashes he can't use the same user for at least 5 hours, because he has to wait for the P to go to 0!
Thank you,
MAX.
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You coul�d use the HttpSessionBindingListener or HttpSessionListener interfaces
take a look at: http://java.sun.com/j2ee/tutorial/api/index.html
 
Max Nordio
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Marcos Maia:
You coul�d use the HttpSessionBindingListener or HttpSessionListener interfaces
take a look at: http://java.sun.com/j2ee/tutorial/api/index.html



Thank you Marcos,
I tried to use it but when you receive the event of closing session, every single attribute stored in the session is lost and you can't get back the user name whose P must be reset.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic