Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Servlets
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Servlets
destroy servlet ?
Micheal Quai
Greenhorn
Posts: 10
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
... private ServletContext context; ... public void destroy() { this.context=null; } ...
my question is why use context to destroy a
servlet
?(iam from china and my english is not good)
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
All of that is unnecessary, including storing the servletContext as an instance variable.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Micheal Quai
Greenhorn
Posts: 10
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
the servlet code above has been overided the init(servletConfig config) .
public void init(ServletConfig config) throws ServletException { super.init(config); this.context=config.getServletContext();
Micheal Quai
Greenhorn
Posts: 10
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
the servlet code above has been overided the init(servletConfig config) .
public void init(ServletConfig config) throws ServletException { super.init(config); this.context=config.getServletContext();
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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).
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Micheal Quai
Greenhorn
Posts: 10
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
thanks for help me .
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
That's what we are here for!
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
db connection
destroy method
JNDI Lookups
Call destroy() inside init()
can we call destroy() method inside service()
More...