Servlet Introduction

What are Servlets?
  • Java Servlets are the small, platform-independent Java program that run in a web server or application server and provides server-side processing such as accessing a database and e-commerce transactions.
  • Servlets are widely used for web processing.
  • Servlets are designed to handle HTTP requests (get, post, etc.) and are the standard Java replacement for a variety of other methods, including CGI scripts, Active Server Pages (ASPs).
  • Servlets always run inside a Servlet Container.
  • A Servlet Container is nothing but a web Server, which handles user requests and generates response.
  • Servlet Container is different from Web Server because it is only meant for Servlet and not for other files (like .html etc).
Servlets Advantage :
  • Servlet request processing faster than traditional CGI processing because in servlet each request is run in a separate thread.
  • Servlets are scalable. Servlet is multithread so more than one request can be executed and web container uses a thread rather than an operating system process,
  • Servlets are robust and object oriented.
  • Servlets can only be written in the Java programming language.
  • Servlets are platform independent because they are written in Java programming language.
Servlets Disadvantage :
  • Designing in servlet is difficult and slows down the application.
  • Servlet often contain both business logic and ┬ápresentation logic.
  • Writing complex business logic makes the application difficult to understand.
  • We need a Java Runtime Environment on the server to run Servlets. CGI is a completely language independent protocol, so we can write CGIs in whatever languages you have available.


Latest Tutorial

Most Visited Tutorial