Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between web-server and servlet container

Tags:

php

jsp

servlets

What is the difference between "A Web Server" and "A Servlet Container"?
In general are all Web Servers Servlet(Web) Containers too or vice versa?

I have been using Apache Tomcat for JSP and Apache for PHP but unable to figure out the exact difference between those two, where exactly lies the difference?

I tried searching previous threads but could not find much.

Thanks! :-)

like image 258
Prasoon Saurav Avatar asked Dec 14 '09 13:12

Prasoon Saurav


People also ask

What is the difference between server and servlet?

A Servlet Container is a Web Server that must be able to run Java Servlets. Web Server, on the other hand, is a broader term including all software running and communicating through HTTP protocol. Under these definitions: All Servlet Containers are Web Servers.

Is Tomcat a web server or web container?

Apache Tomcat server: Apache Tomcat is a web container. It allows the users to run Servlet and JAVA Server Pages that are based on the web-applications. It can be used as the HTTP server. The performance of the Tomcat server is not as good as the designated web server.

What is the difference between web container EJB container and application server?

An HTTP server can handle only HTML files. A web container or servlet container can handle Servlets and JSPs. An application server contains a web container and EJB container and can handle Servlets, JSPs, and EJBs. EJBs can be deployed only on Application Servers, but not on web containers.

Is Tomcat a servlet container or application server?

Although its flexible configuration and interoperability with supporting technologies have enabled Apache Tomcat to act as a web application server in many circumstances, Tomcat is primarily a Java servlet container.


2 Answers

A Servlet Container is a Web Server that must be able to run Java Servlets.

Web Server, on the other hand, is a broader term including all software running and communicating through HTTP protocol.

Under these definitions:

  1. All Servlet Containers are Web Servers
  2. Not all Web Servers are Servlet Containers. I.E. Apache HTTP Server can not run Java Servlet directly.
like image 83
Pablo Santa Cruz Avatar answered Oct 07 '22 07:10

Pablo Santa Cruz


HTTP is the Hypertext Transport Protocol. Both Apache and Tomcat will accept HTTP requests.

The difference is that Apache is JUST an HTTP server. It serves up static HTML pages.

Tomcat has an HTTP listener inside it, but in addition to that it has a servlet/JSP engine. It can serve up both static and dynamic HTML pages.

You can use Tomcat without Apache.

Apache cannot handle servlet/JSP requests without having a servlet/JSP engine bolted on top of it

like image 45
Velu Avatar answered Oct 07 '22 07:10

Velu