Posts

Showing posts with the label Java EE Basics

Servlets in Java: Web Server vs Application Server and URL Explained for Beginners

What are Servlets? Servlets are Java programs that run on a server and handle client requests, usually coming from a web browser. They are mainly used to build dynamic web applications. Servlets run inside a server environment, which can be classified into: Web Server Application Server 🔹 Web Server A Web Server is a server that contains: Web Server Engine Web Container 🔸 How a Web Server Works A client (browser) sends a request. The web server receives the request. The request is forwarded to the web container. The web container processes the request. A response is generated and sent back to the browser. 🔸 Role of Web Container       Provides a runtime environment for web applications.      Can run only web applications, such as: Servlet applications Spring applications Struts applications 🔸 Web Server Limitations Cannot run enterprise applications (EJB, distributed systems). 🔸 Examples of Web Servers Apache Tomcat GlassFish 🔹 Application Server An ...