Pr.Pg Next Pg

Servlets Packages and Tasks

Servlets Packages

  • Java Servlet specification defines the web containers or web server in which Java Servlet class runs.

  • javax.servlet and javax.servlet.http packages are used for creating servlets which are now became the standard part of Java enterprise edition.

  • This above two packages contains many classes which implements the Java Servlet and JSP specification. Now the latest version of Java Servlet is 3.0 and JSP 2.2 at the time of writing this tutorial.

  • JDK’s javac compiler or any other Java compiler is used to compile Java servlet same as any other java class .

  • Note: Before compiling a Java servlet you need to install the servlet packages and also add them to your computes classpath.


Servlets Tasks

  • Servlets perform the following major tasks:

  1. The Servlet major task is to read client data that is explicitly sent. It may include:
    • Data sent by a web page in form of HTML form

    • Data sent by an applet

    • Data sent by some HTTP clien


  2. The Servlet major task is to read client data that is implicitly sent. It may include:
    • Media types

    • Cookies

    • Different compression

  3. The servlet is responsible for data processing and results are produced on processed data. These processes may include:
    • RMI execution

    • Database communication

    • Calling a web service

    • Call a CORBA

    • A direct response is computed

  4. The servlet is responsilble for sending following type of explicit data to its clients:
    • Binary – GIF,JPEG images

    • Text – HTML/XML

    • Excel

  5. The servlet is responsible for sending responses to its clients. This process may include following:
    • Type of document is informed to client.

    • Caching parameters

    • Cookies Handling

Pr.Pg border                                              Next Pg