File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes How Vendor Use Java Servlet Api and interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How Vendor Use Java Servlet Api and interfaces" Watch "How Vendor Use Java Servlet Api and interfaces" New topic

How Vendor Use Java Servlet Api and interfaces

murali vasu

Joined: Feb 17, 2003
Posts: 2
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.
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

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.
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401
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.
I'd like to know, though, so post back here and let us know what you learned.


comp.lang.javascript FAQ:
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
Might I suggest that you download the source code for Apache Tomcat, read it and then answer the question yourself?

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
murali vasu

Joined: Feb 17, 2003
Posts: 2
Thank U Guys..for prompt replies i would go thru u refer if find anything i will post it.
Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
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
I agree. Here's the link:
subject: How Vendor Use Java Servlet Api and interfaces
It's not a secret anymore!