

{"id":80140,"date":"2020-08-06T22:35:01","date_gmt":"2020-08-06T17:05:01","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=80140"},"modified":"2021-08-25T13:48:18","modified_gmt":"2021-08-25T08:18:18","slug":"jsp-architecture","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/","title":{"rendered":"JSP Architecture &#8211; JSP Processing"},"content":{"rendered":"<p>This article discusses the JSP Architecture and processing of a Java Server. It describes phases like conversion, translation, and execution of a Java server page with interactive diagrams. A complete flow diagram (at last) represents various stages i.e., requests from the web client to the response from the web server.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80393\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg\" alt=\"JSP Architecture\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p>Under JSP newsgroups, one encounters references to Model 1 and Model 2 architectures of JSP. Introduced originally in JSP 0.92 specifications, they are the basic approaches to structure web applications.<\/p>\n<p>In Model 1 architecture of JSP,<\/p>\n<ol>\n<li>User requests for a JSP page.<\/li>\n<li>JSP performs computations related to database, calculations, etc.<\/li>\n<li>JSP gives output and processes it in HTML format.<\/li>\n<\/ol>\n<p>However, Model 2 architecture of JSP is solely based upon the Model-View-Controller Framework, and this is what we are concerned about. MVC is an object-oriented programming approach.<\/p>\n<h2>Model-View-Controller Framework<\/h2>\n<p>To understand JSP processing better, we need to firstly understand the Model-View-Controller framework. MVC individualizes data, business logic, and presentation logic, and still keeps them together as if in a container. MVC implements the &#8216;Front Controller\u2019 pattern for the design and implementation. We will discuss the logical partitioning of the web application in 3 sections.<\/p>\n<h3>Model<\/h3>\n<p>It deals with the business logic of the application and often referred to as an \u201cinner\u201d representation. Model contains the data of the application and, in turn, represents the state of the application. It contains classes that are connected to the database. The model stores the data given by the user as it is connected to it.<\/p>\n<p>For example, a chess game may have a model in which the array represents the board, numbers represent pieces, and some encoding of the rules.<\/p>\n<h3>View<\/h3>\n<p>It is a user interface. It is a presentation layer for the qualified model with little or no programming logic. Its work is to read and display the information fetched by the controller. It is HTML, CSS, JSP etc. The user views the UI through it. For example, in chess, the view would be alternating colors on board and carved pieces.<\/p>\n<h3>Controller<\/h3>\n<p>It acts as an interface between model and view, which recognizes incoming requests. It receives the request from the view layer and passes it to the model layer along with its own computations on the request. Again, the controller takes the generated response from the model and passes it to the view layer so that view can show it as output.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture-MVC-Controller.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80394\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture-MVC-Controller.jpg\" alt=\"MVC Controller\" width=\"795\" height=\"389\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture-MVC-Controller.jpg 795w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture-MVC-Controller-300x147.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture-MVC-Controller-150x73.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture-MVC-Controller-768x376.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture-MVC-Controller-520x254.jpg 520w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/a><\/p>\n<p>In Web applications of Model2 type, requests are in reference to a single URL, a servlet also called as controller through view. This servlet takes a look at the path information of the request to see what it needs to do. For e.g., there may be a complete table of names and actions of JSP pages so that each one of them can be handled. These handlers are the model of the web application. They have the access to databases or perform other calculations. JSP pages (the view) to present the output.<\/p>\n<p><strong>Simply stating the flow of the process is as follows:<\/strong><br \/>\nView&#8212;&#8212;&gt;&gt;Controller&#8212;&#8212;&gt;&gt;Model&#8212;&#8212;&gt;&gt;Database<\/p>\n<p>From view to controller to model that is connected to the database and following the path back from model to view via controller.<\/p>\n<h2>Advantages of MVC<\/h2>\n<p>1)\u00a0 Firstly Its navigation is centrally controlled as the controller is the interface between view and model.<br \/>\n2) Secondly, Model 1 is easier to implement as compared to Model 2 architecture, but the former doesn\u2019t scale. Model 2 scales much better as the websites need to be interactive and easy to handle.<br \/>\n3) Thirdly, MVC is easy to test.<br \/>\n4) It&#8217;s easy to maintain.<br \/>\n5) Easy to extend as it allows specialists to write different parts of the application. Java programmers can write the model and controller, and User interface specialists can write JSP pages that do nothing but display output.<\/p>\n<h2>Example of MVC in JSP<\/h2>\n<p>This example gets the email id and password from the user and gives the welcome message as output following the Model-View-Controller model.<\/p>\n<h3>mvc_example.jsp<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ page language=\"java\" contentType=\"text\/html; charset=ISO-8859-1\"\r\n  pageEncoding=\"ISO-8859-1\"%&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;mvc_example&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;form action=\"mvc_servlet\" method=\"POST\"&gt;\r\nEmail: &lt;input type=\"text\" name=\"email\"&gt;\r\n&lt;br \/&gt;\r\nPassword: &lt;input type=\"text\" name=\"password\" \/&gt;\r\n&lt;input type=\"submit\" value=\"Submit\" \/&gt;\r\n&lt;\/form&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h3>mvc_servlet.java<\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package demotest;\r\nimport java.io.IOException;\r\nimport javax.servlet.RequestDispatcher;\r\nimport javax.servlet.ServletException;\r\nimport javax.servlet.http.HttpServlet;\r\nimport javax.servlet.http.HttpServletRequest;\r\nimport javax.servlet.http.HttpServletResponse;\r\n\r\npublic class Mvc_servlet extends HttpServlet {\r\n  private static final long serialVersionUID = 1L;\r\n  public Mvc_servlet() {\r\n    super();\r\n    \/\/ TODO Auto-generated constructor stub\r\n  }\r\n  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,\r\n  IOException {\r\n    \/\/ TODO Auto-generated method stub\r\n    String email = request.getParameter(\"email\");\r\n    String password = request.getParameter(\"password\");\r\n\r\n    TestBean testobj = new TestBean();\r\n    testobj.setEmail(email);\r\n    testobj.setPassword(password);\r\n    request.setAttribute(\"myBean\", testobj);\r\n    RequestDispatcher rd = request.getRequestDispatcher(\"mvc_success.jsp\");\r\n    rd.forward(request, response);\r\n  }\r\n\r\n}<\/pre>\n<h3><strong>TestBean.java (Model Class)<\/strong><\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package demotest;\r\n\r\nimport java.io.Serializable;\r\n\r\npublic class TestBean implements Serializable {\r\n\r\n  public String getEmail() {\r\n    return email;\r\n  }\r\n  public void setEmail(String email) {\r\n    this.email = email;\r\n  }\r\n  public String getPassword() {\r\n    return password;\r\n  }\r\n  public void setPassword(String password) {\r\n    this.password = password;\r\n  }\r\n  private String email = \"null\";\r\n  private String password = \"null\";\r\n}<\/pre>\n<h3><strong>mvc_success.jsp<\/strong><\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ page language=\"java\" contentType=\"text\/html; charset=ISO-8859-1\"\r\n  pageEncoding=\"ISO-8859-1\"%&gt;\r\n  &lt;%@page import=\"demotest.TestBean\"%&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;Success&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;% \r\nTestBean testobj2=(TestBean)request.getAttribute(\"myBean\"); \r\nout.print(\"WelcomeUser, \"+testobj2.getEmail()); \r\n%&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>The mvc_example.jsp acts as a view for our page that takes in the email and password of the user. The action performed on the form is passing it to the controller that will be an interface between it and model. Thus the request passes to mvc_servlet using the post method.<\/p>\n<p>mvc_servlet extends the Httpservlet. We are using doPost for POST method. It takes request and response as parameters. They take email and password. We have created an object called testobj that sets email, password. Request sets the attribute of the object as myBean. Then Requestdispatcher dispatches requests to mvc_success.jsp.<\/p>\n<p>TestBean is the model for our example that contains getters and setters to get and set the email and password user has entered. In this code, we define email and password in bean class as string type.<\/p>\n<p>mvc_success thus gets the attribute that was dispatched to it from mvc_servlet.java. TestBean object testobj2 has its value as Welcome and email id. thus the output prints a WelcomeUser and email id of the user.<\/p>\n<p>Now, let us look how the java server page processes i.e. from request to response as well as understanding the JSP engine.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80402\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC1.png\" alt=\"MVC model\" width=\"1366\" height=\"159\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC1.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC1-300x35.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC1-1024x119.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC1-150x17.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC1-768x89.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC1-520x61.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80403\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC2.png\" alt=\"MVC in JSP\" width=\"1366\" height=\"120\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC2.png 1366w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC2-300x26.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC2-1024x90.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC2-150x13.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC2-768x67.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/MVC2-520x46.png 520w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/a><\/p>\n<h2>JSP Architecture<\/h2>\n<p>Following is the architecture of Java server pages:<\/p>\n<p>1. Firstly Client sends an http request to the server. As with a normal page, your browser sends an http request to the web browser. For e.g. authentication windows where you enter user id and password in the system and click the submit button, the client thus sends this information to the server to check whether it is valid or not.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80395\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_1.jpg\" alt=\"\" width=\"420\" height=\"156\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_1.jpg 420w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_1-300x111.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_1-150x56.jpg 150w\" sizes=\"auto, (max-width: 420px) 100vw, 420px\" \/><\/a><\/p>\n<p>2. Web server recognizes the request made by the client that is it for a JSP page or any other HTML extension page. If the request made by the client is for a JSP page, then the Web server forwards it to the JSP engine. JSP engine processes the page. This is by using URL or JSP page which ends with .jsp extension.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80396\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_2.jpg\" alt=\"JSP architecture\" width=\"574\" height=\"220\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_2.jpg 574w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_2-300x115.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_2-150x57.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_2-520x199.jpg 520w\" sizes=\"auto, (max-width: 574px) 100vw, 574px\" \/><\/a><\/p>\n<p>3. Then comes the translation phase. This phase is of utmost importance as the JSP engine loads the JSP page, and converts it into servlet content i.e. all the template text converts to println() statements and all JSP elements convert to Java code. As in the diagram hello.jsp gets converted to helloServlet.java. It is important to note that jsp content gets converted to java code in the translation phase.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-80397 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_3.jpg\" alt=\"translation phase of jsp\" width=\"686\" height=\"284\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_3.jpg 686w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_3-300x124.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_3-150x62.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_3-520x215.jpg 520w\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" \/><\/a><\/p>\n<p>4. Translation phase is followed by the compilation phase. JSP engine compiles servlet into .class files that can execute. It forwards the initial request to the servlet engine. As shown in the diagram hello.jsp gets translated to helloServlet.java and then compiled to a class file called helloSevlet.class. This phase is also called the request processing phase as the request is getting processed here.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-80398 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_4.jpg\" alt=\"compilation phase of jsp\" width=\"742\" height=\"388\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_4.jpg 742w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_4-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_4-150x78.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_4-520x272.jpg 520w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/p>\n<p>5. Thereafter the servlet class is loaded by a part of the web container, namely servlet engine, and This class file is then executed. The output is finally produced in HTML format after execution. The output is sent in an HTTP response to the web server by the servlet engine. The diagrams show the complete process.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_5.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80399\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_5.jpg\" alt=\"servlet engine of jsp\" width=\"742\" height=\"388\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_5.jpg 742w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_5-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_5-150x78.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_5-520x272.jpg 520w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/p>\n<p>6. Then The web server forwards the response to the client\u2019s browser. This HTTP response is in the form of static HTML content as it is more user friendly and easily understandable.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_6.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80400\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_6.jpg\" alt=\"http response in jsp\" width=\"742\" height=\"388\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_6.jpg 742w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_6-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_6-150x78.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_6-520x272.jpg 520w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/p>\n<p>7. Finally, the dynamically generated web content is handled statically by the web browser. Then the HTML page inside the HTTP response is handled as if it is a static page.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_7.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-80401 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_7.jpg\" alt=\"web browser in jsp\" width=\"836\" height=\"423\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_7.jpg 836w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_7-300x152.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_7-150x76.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_7-768x389.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-architecture_7-520x263.jpg 520w\" sizes=\"auto, (max-width: 836px) 100vw, 836px\" \/><\/a><\/p>\n<h2>Conclusion<\/h2>\n<p>Finally we have seen JSP Architecture. Processing of a client\u2019s request is in 6 different stages in JSP. Model-View-Controller framework is thus vital for JSP. To explain it briefly: Firstly server receives the request by the client. JSP engine checks if it is a JSP request or other. It then\u00a0 translates the page to java code for the ease of executing it in an understandable programming language. It is then converted to a .class executable file. The HTTP response containing HTML content is sent to the web browser where dynamic content is generated whereas handled statically.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article discusses the JSP Architecture and processing of a Java Server. It describes phases like conversion, translation, and execution of a Java server page with interactive diagrams. A complete flow diagram (at last)&#46;&#46;&#46;<\/p>\n","protected":false},"author":10,"featured_media":80393,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22403],"tags":[22868,22867,22869],"class_list":["post-80140","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jsp","tag-architecture-of-jsp","tag-jsp-architecture","tag-jsp-processing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JSP Architecture - JSP Processing - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn the JSP architecture &amp; various components. See MVC architecture and its use in JSP. Also see Java server pages processing for better understanding.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/jsp-architecture\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JSP Architecture - JSP Processing - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn the JSP architecture &amp; various components. See MVC architecture and its use in JSP. Also see Java server pages processing for better understanding.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/jsp-architecture\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-06T17:05:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-25T08:18:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JSP Architecture - JSP Processing - DataFlair","description":"Learn the JSP architecture & various components. See MVC architecture and its use in JSP. Also see Java server pages processing for better understanding.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/","og_locale":"en_US","og_type":"article","og_title":"JSP Architecture - JSP Processing - DataFlair","og_description":"Learn the JSP architecture & various components. See MVC architecture and its use in JSP. Also see Java server pages processing for better understanding.","og_url":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-08-06T17:05:01+00:00","article_modified_time":"2021-08-25T08:18:18+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33"},"headline":"JSP Architecture &#8211; JSP Processing","datePublished":"2020-08-06T17:05:01+00:00","dateModified":"2021-08-25T08:18:18+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/"},"wordCount":1362,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg","keywords":["architecture of jsp","JSP architecture","jsp processing"],"articleSection":["JSP Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/jsp-architecture\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/","url":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/","name":"JSP Architecture - JSP Processing - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg","datePublished":"2020-08-06T17:05:01+00:00","dateModified":"2021-08-25T08:18:18+00:00","description":"Learn the JSP architecture & various components. See MVC architecture and its use in JSP. Also see Java server pages processing for better understanding.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/jsp-architecture\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Architecture.jpg","width":1200,"height":628,"caption":"JSP Architecture"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/jsp-architecture\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"JSP Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/jsp\/"},{"@type":"ListItem","position":3,"name":"JSP Architecture &#8211; JSP Processing"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team is passionate about delivering top-notch tutorials and resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With expertise in the tech industry, we simplify complex topics to help learners excel. Stay updated with our latest insights.","url":"https:\/\/data-flair.training\/blogs\/author\/dfadteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/80140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=80140"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/80140\/revisions"}],"predecessor-version":[{"id":86533,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/80140\/revisions\/86533"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/80393"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=80140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=80140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=80140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}