wood burning stoves 2.0*
The moose likes Struts and the fly likes ActionServlet destroy() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ActionServlet destroy()" Watch "ActionServlet destroy()" New topic
Author

ActionServlet destroy()

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Is the destroy() method in the ActionServlet where I would place tasks such as invalidating a session, updating DB info for the user like isLoggedIn, and things like that?
Also, when does this method get called?


GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Well, I figured out that when the session timesout, I don't need to invalidate the session. So I think I am alright there.
However, I am still needing to find out some information.
When the session times out, I need to modify the database. But I still need some of the information that is contained in the session. Specifically my UserBean because I need to update the database with the fact that the user has logged out. So I still need to find out when the destroy() method gets called and if there is a method somewhere I can override when the session gets invalidated by the App Server so I can still have by Session for a brief moment.
Thanks.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I found out that I need to use HttpSessionBindingListener which has nothing to do with STRUTS. So if anyone is interested in what I am doing, you can go to http://www.coderanch.com/t/357108/Servlets/java/SessionBindingListener
Thanks.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
In general, with Struts 1.1 you should never need to override the ActionServlet...
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Chris Mathews:
In general, with Struts 1.1 you should never need to override the ActionServlet...

Maybe you and Junilu Lacar could start a good thread as to why one would override the ActionServlet. Since he suggested I do that...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ActionServlet destroy()
 
Similar Threads
Call destroy() inside init()
what code will be there in init() of GenericServlet
calling destroy() from init()
destroy() method in init() method
Question related to Servlet Life cycle