File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlet session tracking in a different way Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet session tracking in a different way" Watch "Servlet session tracking in a different way" New topic
Author

Servlet session tracking in a different way

Preethy Nair
Greenhorn

Joined: Jan 08, 2001
Posts: 2
I need to identify each instance of open browser windows from the servlet side. Since HttpSession identifies a session across multiple windows of the same browser, that does not serve my purpose.
Can anyone help me with ideas?
Thanks in advance!
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Try using cookies, and setMaxAge(-1) of your cookie which will not store the cookie on the HDD and will be stored in the RAM, and as soon as the session is over the cookie expires....
You can also do it using the session object.
Please let me know if that works.
Devan
Originally posted by Preethy Nair:
I need to identify each instance of open browser windows from the servlet side. Since HttpSession identifies a session across multiple windows of the same browser, that does not serve my purpose.
Can anyone help me with ideas?
Thanks in advance!

Mirko Froehlich
Ranch Hand

Joined: Aug 21, 2000
Posts: 114
I still think that multiple browser windows would share the same session, no matter whether you are using session cookies or not. I am not aware of any way you can detect multiple browser windows.
-Mirko

Originally posted by Devan_Anam:
Try using cookies, and setMaxAge(-1) of your cookie which will not store the cookie on the HDD and will be stored in the RAM, and as soon as the session is over the cookie expires....
You can also do it using the session object.
Please let me know if that works.
Devan

Preethy Nair
Greenhorn

Joined: Jan 08, 2001
Posts: 2
I agree with Mirko.
I tried the 'hidden fields' in HTML so that each invokation can be identified. But 'Refresh' from the same browser window will create a new identification for it. That is not what I want.
Can anyone think of a better solution?
Mirko Froehlich
Ranch Hand

Joined: Aug 21, 2000
Posts: 114
Preethy,
Can you tell us what exactly you are trying to accomplish, i.e. why you want to identify each open browser window? Maybe you can redesign your application to achieve the same effect without this requirement.
-Mirko

Originally posted by Preethy Nair:
I agree with Mirko.
I tried the 'hidden fields' in HTML so that each invokation can be identified. But 'Refresh' from the same browser window will create a new identification for it. That is not what I want.
Can anyone think of a better solution?

Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
If you open this windows using javascript window.open(url, windowName), you can try to use hidden variable, with value equal to window name, that you specify in open function, or use this name as part of request, something like http://myfile.html?winName=win1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet session tracking in a different way
 
Similar Threads
Session Management
clarification : HFS page 266
cookies exist when we close browser?
Session handling in servlets
session and new window