Servlet Introduction

Servlet

Servlet is a technology which resides on server. It is small,component based, platform independent technology for building web applications.

Web Application

An application accessed via web browser over a network such as internet or intranet.It is composed of web component like xhtml,servlet,jsp etc.

Web Component

A software entity which provides response to a web request. e.g servlet

Web Client

A browser which sends request to a server for a output. e.g ie

J2EE Container

It provides run time environment for web component that includes life cycle management, deployment,security etc. It is classified as:

1) Web Container\server: It hosts web component like servlets. e.g Tomcat server

2) Application Container\server: It is used for developing enterprise application. e.g Jboss,Websphere etc

Role of servlet in developing web applications:

1) Servlet reads implicit and explicit data sent by browser.

2) Servlet can dynamically generate and send content back to client.

3) Interact with server resources like DB, files etc.

4) Forward request from one server to another for load balancing.

5) Provide authentication and security,session mechanism.

Advantages of Servlets:

1) Platform Independent as it is written in java.

2) Multithreaded: It allow client request handeled by separate thread with in a single process.

3) Secure: It is written in java. So invalid memory access calls and strong type violation not possible.

4) Robust: As these are managed by JVM so memory leak, garbage collection handeled automatically.

5) Performance: Better performance because of a thread for each request.