Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to handle sessions in JSP/Struts app

843840Dec 11 2007 — edited Dec 11 2007
Hi Friends,
I have a jsp/struts/servlets based web application in which i would like to have these two conditions:

1. The user session should invalidate after 10 mins of inactivity.
2. Two users cannot log in simulatenously using the same username/password.

So, I do this:
request.getSession().setAttribute("user",uname);                    request.getSession().setMaxInactiveInterval(10);
To satisfy condition 2, I am thinking to apply filter but i don't know how to do this.

Can someone please tell me what's the right way to accomplish this scenario? Is there anyway, that i can trigger an event before the session invalidates.

I can set a flag in the database after the user logs in,and then when the session is about to invalidate or the user logs out, reset the flag.

Please help.
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2008
Added on Dec 11 2007
1 comment
253 views