aspose file tools*
The moose likes JSP and the fly likes Session is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Session is not working" Watch "Session is not working" New topic
Author

Session is not working

Prasad Babu
Ranch Hand

Joined: Jul 17, 2005
Posts: 57
Hi, all
Here is my code


The above code is working fine. but my problem is when user has opened one JSP by logging, he is able to open the same page in the different window which is required session. my intension is he should not open same page in different window. i.e. with same user id two pages should not be opened simultaneously. Anybody have the solution?

Thanks in advance.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
If I understand you correctly, yo don't want two or more windows opened by the same user to share the same session. It depends on the browser and how the new window was opened. With IE, if it's opened via file->New (cntrl-N), the new window will share the same session.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Sunil Pradhan
Greenhorn

Joined: Nov 30, 2005
Posts: 15
hi Babu,

I am not clear whether you can restrict the user from sharing the same session with different instance of the browser,but for your login concern you can create (or use a existing one) a session attibute that indicates user is currently loged in.You can crosscheck this attribute before allowing him to login again through different browser instance.



Cheers ,
--------------
Sunil..
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Prasad Babu Dandu:

... but my problem is when user has opened one JSP by logging, he is able to open the same page in the different window which is required session. my intension is he should not open same page in different window. i.e. with same user id two pages should not be opened simultaneously.


There isn't much you can do about this.
Depending on how the user opens the new browser instance, the browser may or may not use the same session cookie for both windows.

For example: With MSIE, if you use CTRL+N to open a new instance both windows will have the same page and will both share the same session ID.
This happens without a call to the server.

If the user opens a new instance of MSIE by clicking on Start -> Programs-> MSIE then the new one will have it's own cookie space and can maintain a separate session within your app.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session is not working