JSP - SPLessons

Chapter 5

JSP Architecture

JSP Architecture

JSP Architecture, JSP is utilized to create dynamic web applications like as a Servlet technology, but gives extra functionalities like custom tags, JSTL, expression dialect. JSP concentrates for the most part of presentation logic of the application. Servlet runs quicker than JSP, the fundamental favorable position of JSP is less coding contrasted with servlets.
JSP contains both Java and HTML in the same file. JSP is same like HTML, but the difference in JSP developer writes Java code with script tags. JSP can be easily managed because business logic is separated from presentation logic. But in Servlet technology, both will be mixed up. When JSP page is updated, there is no need to recompile and redeploy the project.

JSP Architecture, Following is the basic architecture of JSP to understand how the code flows.

Flow Code

When client requests to the server through the internet then the web server recognizes that the HTTP request is for a JSP page and forwards it to a JSP engine. This is done by using the URL or JSP page which ends with.Jsp instead of.Html. web server checks the data in the database and gives back to the client where the requested page by the client may be HTML, JSP.
JSP Architecture, The .class file of Servlet is executed by the JSP container and the yield of execution is sent to client as response. On the off chance that the same JSP file is not utilized once more, the .class file is erased. In the event that utilized again and regularly, the .class file is held by the container for further use without the need of second time interpretation and compilation. This is to build the execution.

JSP Compilation

The JSP container software compiles the Servlet source code (.java file) into a Servlet .class file. This is known as JSP compilation.


  • JSP Architecture – The server gives the Http response to the client in the form of HTML data.
  • The requested data by the client may be JSP page OR HTML page.
  • JSP file will be converted into a servlet source file by the JSP container with the .java extension.