I'm trying to understand How Java interfaces implementation are used vendors, My Question is while Working with Servlet,When i write my Servlet i just implement Servlet Interface and override Interface methods ? I Don't understand why i have to use servlet Interface,How My servlet is getting intailized ? can anyone pl explain with sample code how webserver vendor uses interface and Java API to make servlet working.
I don't think you'll quite understand it in one lil example. Check out Core Servlets and JavaServer Pages by our good friend Marty Hall. Since his newer book, "More Servlets and JavaServer Pages" came out, Marty's been kind enough to put a full electronic copy of Core Servlets online and available to download, for free. Check out the first couple chapters -- they explain the basics of servlets and how they work.
Actually, you extend HttpServlet. It's an abstract class. Nonetheless, you ask a valid question, and a question which is (even after this) still unanswered. Maybe you can check on the Jakara Tomcat Developer's list. http://jakarta.apache.org/site/mail.html I'd like to know, though, so post back here and let us know what you learned.
By extending HTTpservlet You are writing your as per your specification. So every vendor knows how to instantiate your servlet. They do this by using class.forName("yourservlet").getInstance(). Remember this dynamic loading of the class can be done only if the clas can be instantiated with out any arguments HTH Hari