aspose file tools*
The moose likes JSP and the fly likes Test for Session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Test for Session" Watch "Test for Session" New topic
Author

Test for Session

Surest Uncle
Greenhorn

Joined: May 23, 2008
Posts: 1
How do I test for Session either open or closed using javaScript in a JSP?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

"Surest Uncle", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

What do you mean by "open" or "closed" session?

If you are in a JSP, there will be a valid session. Are you trying to discover if the previous session has expired and you are in a new one?
Ali Khalfan
Ranch Hand

Joined: Nov 03, 2007
Posts: 126
don't think you could use javascript to access a session variable, why not store some variable in a session and then display it on the page somewhere..if it shows null then you'll know
Prasad Tamirisa
Ranch Hand

Joined: Mar 26, 2007
Posts: 130
This is also one of the ways, but not using java script.

Use reqeust.getSession() in a scriptlet and find out if the session is dead or active.
[ May 24, 2008: Message edited by: Prasad Tamirisa ]

Regards,
Durga Prasad
 
 
subject: Test for Session