wood burning stoves 2.0*
The moose likes Servlets and the fly likes can we call service() and destroy() inside init() of servlet 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 » Java » Servlets
Bookmark "can we call service() and destroy() inside init() of servlet" Watch "can we call service() and destroy() inside init() of servlet" New topic
Author

can we call service() and destroy() inside init() of servlet

ramu yadiki
Greenhorn

Joined: Jul 26, 2013
Posts: 13

Hi friends can you explain this thing...

can we call service() and destroy() inside init() of servlet
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

No, you cannot call service. Where would the request and response instances come from?

And yes, you can call destroy() but why would anyone do such a silly thing?

(And, in case you are thinking that destroy() destroys the servlet -- it doesn't.)


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can we call service() and destroy() inside init() of servlet
 
Similar Threads
Servlet's init() and destroy() method and constructors
call detroy in init
Question on Servlet Redirection
can we call destroy method in servlet service method?
destroy() method of servlets