• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help on removing PageContext  RSS feed

 
akk kazi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created the following pageContext session:



I know how to remove it but there is a situation where a user directly closes the browser, I need to remove the pagecontext session even if the user closes the browser intentionally or unintentionally.
Any help would be appreciated.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
akk kazi wrote:I have created the following pageContext session:


No. That has nothing at all to do with the session. With this statement you have created a scoped variable named temp in application scope. The session is not involved in this.

Did you intend to put the scoped variable into the session? If so, you need to specify SESSION_SCOPE rather than application scope.

I know how to remove it but there is a situation where a user directly closes the browser, I need to remove the pagecontext session even if the user closes the browser intentionally or unintentionally.

Cannot be done. There is no definitive way to know that the user has abandoned the browser.

The best way to handle this is to put the scoped variable into the session, and then let the session timeout handle invalidating the session (and along with it, the scoped variable).

As this is tied to a single user in any case, application scope is certainly the wrong place to put the variable.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This also hints that you might be putting Java code into a JSP page. If so, then you need to update your JSP knowledge seriously. Java scriptlets in JSPs have been obsolete for over 13 years!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!