简体   繁体   中英

Difference between web-server and servlet container

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! :-)

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. IE Apache HTTP Server can not run Java Servlet directly.

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

ServletContext是一个特定于应用程序的对象,而ServletConfig是一个Servlet特定的对象。当Web容器实例化相应的servlet时,创建ServletConfig对象

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM