• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session.removeAttribute In the jspDestroy() !!!  RSS feed

 
lee gueishen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hellp!
I want to try remove attribute in Session,
so ...
<%!
HttpSession MySession = PageContext.getSession;
public void jspDestroy(){
MySession.removeAttribute("aaa",aaa);
}
%>
it seems be OK
but error occur
when can tell me
thinks!!!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, since the above will not compile, it's a sure bet that it won't work. Is that your issue? If so, you need to pay attention to case.
[ February 24, 2004: Message edited by: Bear Bibeault ]
 
lee gueishen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for Bear Bibeault's answer and sorry for my confuse question . I just want to know , How I can use "session.removeAttribute()" in jspDestroy() . Thanks !!!
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello lee gueishen,
There is no direct relationship between Session and Servlet. Servlet serves multiple requests, coming from multiple clients. Hence Servlet is associated with multiple Sessions.
Also destroy method is called when servlet is removed from the server. This is can be either when server is shtting down, or server is overloaded and there has been no request for this servlet from long time.
Now back to your question, you want to remove certain objects from session when destroy method is called. The first question is from which session? as servlet is serving many sessions.
Can you please further elaborate your requirement?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!