Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet container - what is the real definition?

 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The request is received by the Web server and handed off to the servlet con-
tainer. The servlet container can be running in the same process as the host
Web server, in a different process on the same host, or on a different host from
the Web server for which it processes requests.


The above text is from servlet specification. I can't understand the next issue: Is the servlet container and web-server the same thing? Is, for instance, Tomcat just a servlet container, or both of them? From the above definition i deduct that servlet container and web server are two different things. Why than to run a web application, we just install Tomcat, without any additional web server? Illuminate me, please!
 
Saifuddin Merchant
Ranch Hand
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A web server is something that just does one Job and that is to serve static web pages. Web server takes care of getting a request to a web page and getting the web page back to the user.
Apache is a web server.

The servlet container is the process that takes care of executing the Servlet/Jsp code and turning them into web page that the web server can deliver back to the client.
Tomcat is a web container.

The only reason that you do not have to install a separate web server when you install Tomcat is because Tomcat installs the Apache web server and the Tomcat Container. (That's why its called Apache Tomcat I assume )
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The FAQ entry on the topic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic