aspose file tools*
The moose likes Servlets and the fly likes ServletConfig in Constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ServletConfig in Constructor" Watch "ServletConfig in Constructor" New topic
Author

ServletConfig in Constructor

Divyya Joshi
Ranch Hand

Joined: Jul 15, 2010
Posts: 102
Can anyone please tell why can't we use ServletConfig in constructor?
I read Kathy Sierra for SCWCD-1.5 but still i am not able to understand the exact reason
Please guide me.
Thanks in advance.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12682
    
    5
Simple explanation: That is not the way it (the servlet API) works!

The architecture of having a container create an instance with a no-args constructor combined with a separate initialization method is common in Java, get used to it.

Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ServletConfig in Constructor
 
Similar Threads
Why Init() method
init() method in a Servlet's lifecycle.
why we cant't use constructor for initializing servlet
Why init() if constructor is there
basic question