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 can i called the constructor in servlet file?If Yes how can?If no why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "can i called the constructor in servlet file?If Yes how can?If no why?" Watch "can i called the constructor in servlet file?If Yes how can?If no why?" New topic
Author

can i called the constructor in servlet file?If Yes how can?If no why?

dev pandya
Greenhorn

Joined: Jun 10, 2008
Posts: 14
can i called the constructor in servlet?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

A servlet is a Class, so yes you can call the constructor. The servlet is designed to run inside a container, however, and the container only knows how to interact with the servlet in certain ways, and it also expects the servlet to behave in particular ways in response to those interactions.

Servlets are not supposed to use constructors, so while while it is valid it is not really a 'servlet' thing to do.
[ June 11, 2008: Message edited by: David O'Meara ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can i called the constructor in servlet file?If Yes how can?If no why?
 
Similar Threads
Dbt on getServletConfig()
Servlet's constructor
init and destroy.
Can we write initialization code in servlet constructor
Why do we have init() method in Servlets ?