The init() is part of the servlet life cycle management facility. Instead of using constructor, which is invoked when the instance is created, using a well defined, common life cycle method would help in more advanced management. In other words, the life cycle methods defined in javax.servlet.Servlet provide a contract where all servlet have to comply. You cant define constructor method in java interface right?
SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
This is a often asked question in this forum, and rightfully so, as it is an important part of understanding the lifecycle of a servlet. Bear summed it up in his response, but if you want to see some more in depth answers, search this forum for "init() constructor" and you will find several threads dealing with this issue.
If you still have questions after looking, please post them!
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
It is part of servlet life cycle designed by javasoft.And main purpose of init() is to retrive configuration parameters from web.xml.It is not possible to get initialization parameters through constructor and webcontainer accepts only default constructor. If u develop a servlet with parameterized constructor, it(webcontainer) raise an error.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com