• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sessions in JSP page

 
jaya sudha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody..........

I have session variable for a jsp page..whenever user opens the page var=0 and again if he refreshes the pages var=1 ...
But once he close the page and if again he opens the same page var should become zero. But it not happening with my page again the var is incremented..
I hope whenever a page is closed and again if opened a new session should..Am i right???

Thanks and please help me
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for some version of IE new session is created on server for every new session of browser,but this dose not happens with Netscape.

But you should't rely on browser.

Invalidate your session when user logs off..
thats the simple solution..i dont think you can do some action on sever when window (browser) is closed.

just for my knowledge ..which browser are you using ??

Cheer
-Praful
 
jaya sudha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ........

Iam using IE5

any idea???
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A session is ALWAYS lost when the browser application is closed.

With Notscape this is (incorrectly) implemented as happening when the browser WINDOW is closed, in IE it is (correctly) implemented as happening when the LAST window closes that was spawned from the same browser instance.

If the window was opened using Ctrl-N or File->New-Window (for example) you're still in the same session.

If you open a new browser from the desktop, taskbar or startmenu a new browser instance is started which will yield a new session.
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i said..you cannot notify server when window is closed (at least im not aware of mehtod if nay ) the simplest option is to invalidate session.when user log offs
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can fire off a request in a Javascript onclose event which causes the session to be invalidated but you cannot rely on it being called (just killing the browser instance for example will bypass it).
 
jaya jaya
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be you can do something with session.isNew()....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!