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

Diff between Web & Servlet container

Sandeep Jindal
Ranch Hand

Joined: Aug 25, 2003
Posts: 180
Hi All,

Please tell me what is the difference between a servlet container and a web container.
What i think is, either both means same or, web container means a container for web modules, that may be just html pages and need not be jsp/sevlets/etc. And servlet container is the one that processes the full life cycle of a servlet.
In other words, web container is sub set of servlet container.
Please tell me if i am correct or correct me other wise

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Web or HTTP servers generally handle only static content - images and HTML pages and such. When they recognize dynamic content requests by extension or path or some other indicator they pass the request on to CGI, ASP, servlet, etc. So a servlet container is a "plugin" to an HTTP server. In my WebSphere project they are on separate boxes, but some other products may bind them together so neatly that you can barely see the seams.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Sandeep Jindal
Ranch Hand

Joined: Aug 25, 2003
Posts: 180
Hi Stan,

Thanks for the clear explanation.

Can you please tell me some example server, where i have a web/http server(Both are same, rite??), and a pluggable servlet container. Do tomcat provide this feature?

Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
yes. but not very efficient with static web contents like images and etc.
Afroz Ahmed
Ranch Hand

Joined: Jan 18, 2004
Posts: 64
Web container only for request/response and gets all static pages
Servlet Container can do dynamic things and send dynamic reposes..

For clear clarification refer 'Head First Servlets and JSP' by Kathy Sierra.

Not a member of Head First Series Marketing Team.
[ October 11, 2004: Message edited by: Afroz Ahmed ]

The value of an idea lies in the usage of it.
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 160
The concept of Web Servers came before the Concept of Application Servers.

ie earlier there were server programs available which was able to satisfy requests for static contents
like a text/image/any kind of file. These servers have a context within which the files which can be served
by this server are kept. and this context can be reffered as WEB CONTAINER.

later when the concept of Application Servers came, they were introduced as plugin components,
since there were lots of Standalone WebServers were already there.

Later, when there were webservers which came with the built-in support of application Servers. ie
now-a-days, when you buy a AppServer, it has a WebServer built along with it.

BEA WebLogicServer,iPlanet,WebShpere.. all these servers have both web & app servers together.These
can also be configured as just web-servers and use anyother server as servlet container. If done so, since
the request has to pass to two different servers,two different JVM's, it has its own overhead.

Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
I agree. Here's the link:
subject: Diff between Web & Servlet container
jQuery in Action, 3rd edition