This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes How many different ways to create Servlets ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How many different ways to create Servlets ?" Watch "How many different ways to create Servlets ?" New topic

How many different ways to create Servlets ?


Joined: Feb 25, 2007
Posts: 2
Hi all,

We can create servlets by ;

a) Servlets by extending two classes and over write methods
b) retrive the existing Servlets from the pool

Is there any other way to create Servlets ?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548


There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

JavaRanch Sheriff

[Asking smart questions] [About Bear] [Books by Bear]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
I'm not sure that I understand your question. You create a servlet by declaring it in the web.xml file. The class needs to implement the Servlet interface.

As to a), in Java a class can not extend two classes - only a single one. Or did you mean youj can either extend GenericServlet or HttpServlet?

As to b), what pool are you talking about?
[ February 25, 2007: Message edited by: Ulf Dittmer ]
Consider Paul's rocket mass heater.
subject: How many different ways to create Servlets ?
It's not a secret anymore!