top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Java Servlet

0 votes
310 views

Servlet technology is used to create web application (resides at server side and generates dynamic web page).

Servlet technology is robust and scalable because of java language. Before Servlet, CGI (Common Gateway Interface) scripting language was popular as a server-side programming language.

Using Servlets, you can collect input from users through web page forms, present records from a database or another source, and create web pages dynamically.

                                               

What is a Servlet

  • Servlet is a technology i.e. used to create web application.
  • Servlet is an API that provides many interfaces and classes including documentations.
  • Servlet is an interface that must be implemented for creating any servlet.
  • Servlet is a class that extend the capabilities of the servers and respond to the incoming request. It can respond to any type of requests.
  • Servlet is a web component that is deployed on the server to create dynamic web page.

                                                                                                                                             

 

Servlets Architecture

                                                                 

 

Advantage of Servlet

There are many advantages of servlet over CGI. The web container creates threads for handling the multiple requests to the servlet. Threads have a lot of benefits over the Processes such as they share a common memory area, lightweight, cost of communication between the threads are low. The basic benefits of servlet are as follows:

1.     better performance: because it creates a thread for each request not process.

2.     Portability: because it uses java language.

3.     Robust: Servlets are managed by JVM so we don't need to worry about memory leak, garbage collection etc.

4.     Secure: because it uses java language.

 

Java Packages

Java Servlets are Java classes run by a web server that has an interpreter that supports the Java Servlet specification.

Servlets can be created using the javax.servlet and javax.servlet.http packages, which are a standard part of the Java's enterprise edition, an expanded version of the Java class library that supports large-scale development projects.

These classes implement the Java Servlet and JSP specifications.

Java servlets have been created and compiled just like any other Java class. After you install the servlet packages and add them to your computer's Classpath, you can compile servlets with the JDK's Java compiler or any other current compiler.

Go through this video

posted Sep 13, 2017 by Ayush Srivastav

  Promote This Article
Facebook Share Button Twitter Share Button LinkedIn Share Button

...