{"id":25536541,"date":"2022-08-04T02:15:39","date_gmt":"2022-08-03T20:45:39","guid":{"rendered":"https:\/\/entri.app\/blog\/?p=25536541"},"modified":"2022-11-23T14:50:20","modified_gmt":"2022-11-23T09:20:20","slug":"what-are-java-servlets-and-servlets-basics","status":"publish","type":"post","link":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/","title":{"rendered":"What Are Java Servlets and Servlets Basics?"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e746fd79a4c\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e746fd79a4c\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#Properties_of_Servlets_are_as_follows\" >Properties of Servlets are as follows<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#Servlet_Architecture\" >Servlet Architecture<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#Stages_of_the_Servlet_Life_Cycle\" >Stages of the Servlet Life Cycle<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#Servlet_Life_Cycle_Methods\" >Servlet Life Cycle Methods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#Servlet_Life_Cycle\" >Servlet Life Cycle<\/a><\/li><\/ul><\/nav><\/div>\n<p>Servlets are the Java programs that run on the Java-enabled web server or application server. They are used to handle the request obtained from the webserver, process the request, produce the response, then send a response back to the webserver.<\/p>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\">Learn Coding in your Language! Enroll Here!<\/a><\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Properties_of_Servlets_are_as_follows\"><\/span><strong>Properties of Servlets are as follows<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>Servlets work on the server-side.<\/li>\n<li>Servlets are capable of handling complex requests obtained from the webserver.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Servlet_Architecture\"><\/span><strong>Servlet Architecture<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Execution of Servlets basically<strong>\u00a0<\/strong>involves six basic steps:<\/p>\n<ol>\n<li>The clients send the request to the webserver.<\/li>\n<li>The web server receives the request.<\/li>\n<li>The web server passes the request to the corresponding servlet.<\/li>\n<li>The servlet processes the request and generates the response in the form of output.<\/li>\n<li>The servlet sends the response back to the webserver.<\/li>\n<li>The web server sends the response back to the client and the client browser displays it on the screen.<\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Stages_of_the_Servlet_Life_Cycle\"><\/span><strong>Stages of the Servlet Life Cycle<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The Servlet life cycle mainly goes through four stages,<\/p>\n<ul>\n<li>Loading a Servlet.<\/li>\n<li>Initializing the Servlet.<\/li>\n<li>Request handling.<\/li>\n<li>Destroying the Servlet.<\/li>\n<\/ul>\n<ol>\n<li><strong>Loading a Servlet<\/strong>: The first stage of the Servlet lifecycle involves loading and initializing the Servlet by the Servlet container. The Web container or Servlet Container can load the Servlet at either of the following two stages :\n<ul>\n<li>Initializing the context, on configuring the Servlet with a zero or positive integer value.<\/li>\n<li>If the Servlet is not preceding stage, it may delay the loading process until the Web container determines that this Servlet is needed to service a request.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>The Servlet container performs two operations in this stage :<\/p>\n<ul>\n<li><strong>Loading :<\/strong>Loads the Servlet class.<\/li>\n<li><strong>Instantiation :<\/strong>Creates an instance of the Servlet. To create a new instance of the Servlet, the container uses the no-argument constructor.<\/li>\n<\/ul>\n<ol start=\"2\">\n<li><strong>Initializing a Servlet<\/strong>: After the Servlet is instantiated successfully, the Servlet container initializes the instantiated Servlet object. The container initializes the Servlet object by invoking the\u00a0<strong>init(ServletConfig)<\/strong>method which accepts ServletConfig object reference as parameter.<\/li>\n<\/ol>\n<p>The Servlet container invokes the\u00a0<strong>Servlet.init(ServletConfig)<\/strong>\u00a0method only once, immediately after the\u00a0<strong>Servlet.init(ServletConfig)<\/strong>\u00a0object is instantiated successfully. This method is used to initialize the resources, such as JDBC datasource.<\/p>\n<p>Now, if the Servlet fails to initialize, then it informs the Servlet container by throwing the\u00a0<strong>ServletException<\/strong>\u00a0or\u00a0<strong>UnavailableException<\/strong>.<\/p>\n<ol start=\"3\">\n<li><strong>Handling request<\/strong>: After initialization, the Servlet instance is ready to serve the client requests. The Servlet container performs the following operations when the Servlet instance is located to service a request :\n<ul>\n<li>It creates the\u00a0<strong>ServletRequest<\/strong>and\u00a0<strong>ServletResponse<\/strong> In this case, if this is a HTTP request, then the Web container creates\u00a0<strong>HttpServletRequest<\/strong>\u00a0and\u00a0<strong>HttpServletResponse<\/strong>\u00a0objects which are subtypes of the\u00a0<strong>ServletRequest<\/strong>\u00a0and\u00a0<strong>ServletResponse<\/strong>\u00a0objects respectively.<\/li>\n<li>After creating the request and response objects it invokes the Servlet.service(ServletRequest, ServletResponse) method by passing the request and response objects.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>The\u00a0<strong>service()<\/strong>\u00a0method while processing the request may throw the\u00a0<strong>ServletException<\/strong>\u00a0or\u00a0<strong>UnavailableException<\/strong>\u00a0or\u00a0<strong>IOException<\/strong>.<\/p>\n<ol start=\"4\">\n<li><strong>Destroying a Servlet<\/strong>: When a Servlet container decides to destroy the Servlet, it performs the following operations,\n<ul>\n<li>It allows all the threads currently running in the service method of the Servlet instance to complete their jobs and get released.<\/li>\n<li>After currently running threads have completed their jobs, the Servlet container calls the\u00a0<strong>destroy()<\/strong>method on the Servlet instance.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>After the\u00a0<strong>destroy()<\/strong>\u00a0method is executed, the Servlet container releases all the references of this Servlet instance so that it becomes eligible for garbage collection.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\"><strong>Learn to code from industry experts! Enroll here<\/strong><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Servlet_Life_Cycle_Methods\"><\/span><strong>Servlet Life Cycle Methods<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are three life cycle methods of a Servlet :<\/p>\n<ul>\n<li>init()<\/li>\n<li>service()<\/li>\n<li>destroy()<\/li>\n<\/ul>\n<p>Let\u2019s look at each of these methods in details:<\/p>\n<p><strong>init() method<\/strong>: The\u00a0<strong>Servlet.init()<\/strong>\u00a0method is called by the Servlet container to indicate that this Servlet instance is instantiated successfully and is about to put into service.<\/p>\n<p>\/\/init() method<\/p>\n<p>public class MyServlet implements Servlet{<\/p>\n<p>public void init(ServletConfig config) throws ServletException {<\/p>\n<p>\/\/initialization code<\/p>\n<p>}<\/p>\n<p>\/\/rest of code<\/p>\n<p>}<\/p>\n<p><strong>service() method<\/strong>: The\u00a0<strong>service()<\/strong>\u00a0method of the Servlet is invoked to inform the Servlet about the client requests.<\/p>\n<ul>\n<li>This method uses\u00a0<strong>ServletRequest<\/strong>object to collect the data requested by the client.<\/li>\n<li>This method uses\u00a0<strong>ServletResponse<\/strong>object to generate the output content.<\/li>\n<\/ul>\n<p>\/\/ service() method<\/p>\n<p>public class MyServlet implements Servlet{<\/p>\n<p>public void service(ServletRequest res, ServletResponse res)<\/p>\n<p>throws ServletException, IOException {<\/p>\n<p>\/\/ request handling code<\/p>\n<p>}<\/p>\n<p>\/\/ rest of code<\/p>\n<p>}<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>destroy() method<\/strong>: The\u00a0<strong>destroy()<\/strong>\u00a0method runs only once during the lifetime of a Servlet and signals the end of the Servlet instance.<\/p>\n<p>&nbsp;<\/p>\n<p>\/\/destroy() method<\/p>\n<p>public void destroy()<\/p>\n<p>&nbsp;<\/p>\n<p>As soon as the\u00a0<strong>destroy()<\/strong>\u00a0method is activated, the Servlet container releases the Servlet instance.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Servlet_Life_Cycle\"><\/span><strong>Servlet Life Cycle<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Servlet life cycle can be defined as the stages through which the servlet passes from its creation to its destruction.<br \/>\nThe servlet life cycle consists these stages:<\/p>\n<ul>\n<li>Servlet is borned<\/li>\n<li>Servlet is initialized<\/li>\n<li>Servlet is ready to service<\/li>\n<li>Servlet is servicing<\/li>\n<li>Servlet is not ready to service<\/li>\n<li>Servlet is destroyed<\/li>\n<\/ul>\n<h3><strong>Life cycle methods<\/strong><\/h3>\n<p>Life cycle methods are those methods which are used to control the life cycle of the servlet. These methods are called in specific order during the servlets\u2019s entire life cycle.<br \/>\nThe class\u00a0<strong>Servlet<\/strong>\u00a0provides the methods to control and supervise the life cycle of servlet. There are three life cycle methods in the Servlet interface. There are as follows:<\/p>\n<ul>\n<li><strong>init() method :<\/strong>\n<ol>\n<li>A servlet\u2019s life begins here .<\/li>\n<li>This method is called only once to load the servlet.Since it is called only once in it\u2019s lifetime,therefore \u201cconnected architecture\u201d code is written inside it because we only want once to get connected with the database.<br \/>\nNow Question Arises is that:-<br \/>\nWhy can\u2019t we write connected architecture code inside the constructor, since constructor also run only once in it\u2019s entire life?<br \/>\nAns. Suppose if the connection doesn\u2019t get established, then we can throw an exception from init() and the rest of the steps stop executing. But in the constructor we can\u2019t use, throw in it\u2019s prototype otherwise it is an error.<\/li>\n<li>This method receives only one parameter, i.e\u00a0<strong>ServletConfig<\/strong><\/li>\n<li>This method has the possibility to throw the ServletException.<\/li>\n<li>Once the servlet is initialized, it is ready to handle the client request.<\/li>\n<li>The prototype for the init() method:<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>public void init(ServletConfig con)throws ServletException{ }<\/p>\n<p>Below is a sample program to illustrate Servlet in Java:<\/p>\n<table width=\"708\">\n<tbody>\n<tr>\n<td width=\"708\">\/\/ Java program to show servlet example<\/p>\n<p>\/\/ Importing required Java libraries<\/p>\n<p><strong>import<\/strong> java.io.*;<\/p>\n<p><strong>import<\/strong> javax.servlet.*;<\/p>\n<p><strong>import<\/strong> javax.servlet.http.*;<\/p>\n<p>&nbsp;<\/p>\n<p>\/\/ Extend HttpServlet class<\/p>\n<p><strong>public<\/strong> <strong>class<\/strong> AdvanceJavaConcepts <strong>extends<\/strong> HttpServlet<\/p>\n<p>{<\/p>\n<p><strong>private<\/strong> String output;<\/p>\n<p>&nbsp;<\/p>\n<p>\/\/ Initializing servlet<\/p>\n<p><strong>public<\/strong> <strong>void<\/strong> init() <strong>throws<\/strong> ServletException<\/p>\n<p>{<\/p>\n<p>output = &#8220;Advance Java Concepts&#8221;;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>\/\/ Requesting and printing the output<\/p>\n<p><strong>public<\/strong> <strong>void<\/strong> doGet(HttpServletRequest req,<\/p>\n<p>HttpServletResponse resp)<\/p>\n<p><strong>throws<\/strong> ServletException, IOException<\/p>\n<p>{<\/p>\n<p>resp.setContentType(&#8220;text\/html&#8221;);<\/p>\n<p>PrintWriter out = resp.getWriter();<\/p>\n<p>out.println(output);<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p><strong>public<\/strong> <strong>void<\/strong> destroy()<\/p>\n<p>{<\/p>\n<p>System.out.println(&#8220;Over&#8221;);<\/p>\n<p>}<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: center;\"><strong><a href=\"https:\/\/bit.ly\/3ELmCiA\" target=\"_blank\" rel=\"noopener\">Grab the opportunity to learn Python with Entri! Click Here<\/a><\/strong><\/p>\n<p><strong>Why is it important to choose Entri?<\/strong><\/p>\n<ul>\n<li>Excellent online platform for all the Competitive Exams.<\/li>\n<li>Provides updated materials created by the Entri Experts.<\/li>\n<li>Entri provides a best platform with full- length mock tests including previous year question papers.<\/li>\n<li>You can download the app for free and join the required classes.<\/li>\n<li>Entri wishes you all the best for your examinations and future endeavours.<\/li>\n<\/ul>\n<p><strong>\u201cYOU DON\u2019T HAVE TO BE GREAT TO START, BUT YOU HAVE TO START TO BE GREAT.\u201d<\/strong><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Servlets are the Java programs that run on the Java-enabled web server or application server. They are used to handle the request obtained from the webserver, process the request, produce the response, then send a response back to the webserver. Learn Coding in your Language! Enroll Here! Properties of Servlets are as follows Servlets work [&hellip;]<\/p>\n","protected":false},"author":55,"featured_media":25536543,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[802,558,1882],"tags":[],"class_list":["post-25536541","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles","category-general-knowledge","category-java-programming"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What Are Java Servlets and Servlets Basics? - Entri Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What Are Java Servlets and Servlets Basics? - Entri Blog\" \/>\n<meta property=\"og:description\" content=\"Servlets are the Java programs that run on the Java-enabled web server or application server. They are used to handle the request obtained from the webserver, process the request, produce the response, then send a response back to the webserver. Learn Coding in your Language! Enroll Here! Properties of Servlets are as follows Servlets work [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"Entri Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/entri.me\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-03T20:45:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-23T09:20:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png\" \/>\n\t<meta property=\"og:image:width\" content=\"820\" \/>\n\t<meta property=\"og:image:height\" content=\"615\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ayesha Surayya\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@entri_app\" \/>\n<meta name=\"twitter:site\" content=\"@entri_app\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ayesha Surayya\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/\"},\"author\":{\"name\":\"Ayesha Surayya\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/568cc9d6e77fd5d01033b61c88343097\"},\"headline\":\"What Are Java Servlets and Servlets Basics?\",\"datePublished\":\"2022-08-03T20:45:39+00:00\",\"dateModified\":\"2022-11-23T09:20:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/\"},\"wordCount\":1207,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png\",\"articleSection\":[\"Articles\",\"General Knowledge\",\"Java Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/\",\"url\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/\",\"name\":\"What Are Java Servlets and Servlets Basics? - Entri Blog\",\"isPartOf\":{\"@id\":\"https:\/\/entri.app\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png\",\"datePublished\":\"2022-08-03T20:45:39+00:00\",\"dateModified\":\"2022-11-23T09:20:20+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#primaryimage\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png\",\"width\":820,\"height\":615,\"caption\":\"What Are Java Servlets and Servlets Basics\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/entri.app\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Entri Skilling\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Programming\",\"item\":\"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"What Are Java Servlets and Servlets Basics?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/entri.app\/blog\/#website\",\"url\":\"https:\/\/entri.app\/blog\/\",\"name\":\"Entri Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/entri.app\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/entri.app\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/entri.app\/blog\/#organization\",\"name\":\"Entri App\",\"url\":\"https:\/\/entri.app\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"contentUrl\":\"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png\",\"width\":989,\"height\":446,\"caption\":\"Entri App\"},\"image\":{\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/entri.me\/\",\"https:\/\/x.com\/entri_app\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/entri.app\/blog\/#\/schema\/person\/568cc9d6e77fd5d01033b61c88343097\",\"name\":\"Ayesha Surayya\",\"url\":\"https:\/\/entri.app\/blog\/author\/ayesha-surayya\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What Are Java Servlets and Servlets Basics? - Entri Blog","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:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/","og_locale":"en_US","og_type":"article","og_title":"What Are Java Servlets and Servlets Basics? - Entri Blog","og_description":"Servlets are the Java programs that run on the Java-enabled web server or application server. They are used to handle the request obtained from the webserver, process the request, produce the response, then send a response back to the webserver. Learn Coding in your Language! Enroll Here! Properties of Servlets are as follows Servlets work [&hellip;]","og_url":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/","og_site_name":"Entri Blog","article_publisher":"https:\/\/www.facebook.com\/entri.me\/","article_published_time":"2022-08-03T20:45:39+00:00","article_modified_time":"2022-11-23T09:20:20+00:00","og_image":[{"width":820,"height":615,"url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png","type":"image\/png"}],"author":"Ayesha Surayya","twitter_card":"summary_large_image","twitter_creator":"@entri_app","twitter_site":"@entri_app","twitter_misc":{"Written by":"Ayesha Surayya","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#article","isPartOf":{"@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/"},"author":{"name":"Ayesha Surayya","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/568cc9d6e77fd5d01033b61c88343097"},"headline":"What Are Java Servlets and Servlets Basics?","datePublished":"2022-08-03T20:45:39+00:00","dateModified":"2022-11-23T09:20:20+00:00","mainEntityOfPage":{"@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/"},"wordCount":1207,"commentCount":0,"publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"image":{"@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png","articleSection":["Articles","General Knowledge","Java Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/","url":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/","name":"What Are Java Servlets and Servlets Basics? - Entri Blog","isPartOf":{"@id":"https:\/\/entri.app\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#primaryimage"},"image":{"@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png","datePublished":"2022-08-03T20:45:39+00:00","dateModified":"2022-11-23T09:20:20+00:00","breadcrumb":{"@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#primaryimage","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2022\/08\/What-Are-Java-Servlets-and-Servlets-Basics.png","width":820,"height":615,"caption":"What Are Java Servlets and Servlets Basics"},{"@type":"BreadcrumbList","@id":"https:\/\/entri.app\/blog\/what-are-java-servlets-and-servlets-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/entri.app\/blog\/"},{"@type":"ListItem","position":2,"name":"Entri Skilling","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/"},{"@type":"ListItem","position":3,"name":"Java Programming","item":"https:\/\/entri.app\/blog\/category\/entri-skilling\/java-programming\/"},{"@type":"ListItem","position":4,"name":"What Are Java Servlets and Servlets Basics?"}]},{"@type":"WebSite","@id":"https:\/\/entri.app\/blog\/#website","url":"https:\/\/entri.app\/blog\/","name":"Entri Blog","description":"","publisher":{"@id":"https:\/\/entri.app\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/entri.app\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/entri.app\/blog\/#organization","name":"Entri App","url":"https:\/\/entri.app\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","contentUrl":"https:\/\/entri.app\/blog\/wp-content\/uploads\/2019\/10\/Entri-Logo-1.png","width":989,"height":446,"caption":"Entri App"},"image":{"@id":"https:\/\/entri.app\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/entri.me\/","https:\/\/x.com\/entri_app"]},{"@type":"Person","@id":"https:\/\/entri.app\/blog\/#\/schema\/person\/568cc9d6e77fd5d01033b61c88343097","name":"Ayesha Surayya","url":"https:\/\/entri.app\/blog\/author\/ayesha-surayya\/"}]}},"_links":{"self":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/comments?post=25536541"}],"version-history":[{"count":4,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536541\/revisions"}],"predecessor-version":[{"id":25548010,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/posts\/25536541\/revisions\/25548010"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media\/25536543"}],"wp:attachment":[{"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/media?parent=25536541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/categories?post=25536541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/entri.app\/blog\/wp-json\/wp\/v2\/tags?post=25536541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}