File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes destroy servlet ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "destroy servlet ?" Watch "destroy servlet ?" New topic
Author

destroy servlet ?

Micheal Quai
Greenhorn

Joined: May 24, 2012
Posts: 10


my question is why use context to destroy a servlet ?(iam from china and my english is not good)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

All of that is unnecessary, including storing the servletContext as an instance variable.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Micheal Quai
Greenhorn

Joined: May 24, 2012
Posts: 10
the servlet code above has been overided the init(servletConfig config) .

Micheal Quai
Greenhorn

Joined: May 24, 2012
Posts: 10
the servlet code above has been overided the init(servletConfig config) .

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Again, it is unnecessary to store a reference to the servlet context -- it can easily be obtained from any request. It's also considered poor practice to override init(ServletConfig); you should be overriding init() (the one with no parameters).
Micheal Quai
Greenhorn

Joined: May 24, 2012
Posts: 10
thanks for help me .
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

That's what we are here for!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: destroy servlet ?