This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 63208
    
  69

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: 63208
    
  69

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: 63208
    
  69

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