aspose file tools*
The moose likes Servlets and the fly likes Log in problems using Jsp,Srvlet and Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Log in problems using Jsp,Srvlet and Beans" Watch "Log in problems using Jsp,Srvlet and Beans" New topic
Author

Log in problems using Jsp,Srvlet and Beans

Max Nordio
Greenhorn

Joined: Jul 27, 2001
Posts: 5
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.
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
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

Joined: Jul 27, 2001
Posts: 5
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Log in problems using Jsp,Srvlet and Beans