Basic of Web

Basic of Web

What is a web application?

  • A web application is an application accessible from the web. 
  • A web application is composed of web components like Servlet, JSP, Filter, etc. and other elements such as HTML, CSS, and JavaScript. 
  • The web components typically execute in Web Server and respond to the HTTP request.

What is a Servlet?

  • Servlet technology is used to create a web application.
  • It is run at server side and generates a dynamic web page.
  • Servlet technology is robust and scalable because of java language. 
  • Servlet is an API that provides many interfaces and classes.
  • Servlet is an interface that must be implemented for creating any Servlet.
  • Servlet is a class that extends the capabilities of the servers and responds to the incoming requests. 
  • It can respond to any requests.
  • Servlet is a web component that is deployed on the server to create a dynamic web page.

Figure:


  • Before Servlet, CGI (Common Gateway Interface) scripting language was common as a server-side programming language. 
  • However, there were many disadvantages to this technology. 
  • Disadvantages of CGI
    • If the number of clients increases, it takes more time for sending the response.
    • For each request, it starts a process, and the webserver is limited to start processes.
    • It uses platform dependent language e.g. C, C++, perl.

Advantages of Servlet:

  • There are many advantages of Servlet over CGI. 
  • Figure:
  • The web container creates threads for handling the multiple requests to the Servlet. 
  • Threads have many benefits over the Processes such as they share a common memory area, lightweight, cost of communication between the threads are low. 
  • Figure:
  • The advantages of Servlet are as follows:
    • Better performance: because it creates a thread for each request, not process.
    • Portability: because it uses Java language.
    • Robust: JVM manages Servlets, so we don't need to worry about the memory leak, garbage collection, etc.
    • Secure: because it uses java language.
  • There are many interfaces and classes in the Servlet API such as Servlet, GenericServlet, HttpServlet, ServletRequest, ServletResponse, etc.


Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form