{"id":1063,"date":"2018-08-23T01:59:11","date_gmt":"2018-08-23T01:59:11","guid":{"rendered":"https:\/\/www.gologica.com\/blog\/?p=1063"},"modified":"2025-04-06T03:12:04","modified_gmt":"2025-04-06T03:12:04","slug":"jsp-interview-questions-and-answers","status":"publish","type":"post","link":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/","title":{"rendered":"JSP Interview Questions and Answers"},"content":{"rendered":"<p><strong>What is JSP?<\/strong><br \/>\nJSP stands for Java Server Page, It is a server side technology and it is used to prepare presentation\/view part in the web application development.<br \/>\nJSP is used to create web application just like Servlet technology. It can be thought of as an extension to Servlet because it provides more functionality than servlet such as expression language, JSTL, etc.<br \/>\nA JSP page consists of HTML tags and JSP tags. The JSP pages are easier to maintain than Servlet because we can separate designing and development. It provides some additional features such as Expression Language, Custom Tags, etc.<\/p>\n<p><strong>What are advantages of using JSP?<\/strong><br \/>\nJSP offer several advantages listed below:<br \/>\nJSP is always compiled before it&#8217;s processed by the server unlike.<br \/>\nPerformance is significantly better because JSP allows embedding Dynamic Elements in HTML pages itself.<\/p>\n<p><strong>Difference between JSP &amp; Servlets?<\/strong><\/p>\n<p>In JSP we can easily separate the presentation Logic with Business Logic but in servlets both are combined<br \/>\nOne servlet object is communicated with many number of objects, but jsp it is not possible.<\/p>\n<p><strong>What is the web application scope?<\/strong><\/p>\n<p>There are 3 web application scopes. They are<br \/>\nRequest<br \/>\nSession<br \/>\nApplication<\/p>\n<p><strong>What is a JSP declaration?<\/strong><\/p>\n<p>A declaration declares one or more variables or methods that you can use in Java code later in JSP file. You must declare the variable or method before you use it in the JSP file<br \/>\n&lt;%declaration; [declaration;]&#8230;.%&gt;<\/p>\n<p><strong>What are JSP expressions?<\/strong><\/p>\n<p>A JSP expression element contains a scripting language expression that is evaluated, converted to a string, and inserted where the expression appears in the JSP file.<\/p>\n<p><strong>What are JSP directives?<\/strong><\/p>\n<p>A JSP directive affects the overall structure of the servlet class. It usually has the following form: &lt;%@ directive attribute=&#8221;value&#8221; %&gt;<\/p>\n<p><strong>What are the JSP actions?<\/strong><\/p>\n<p>JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse Java Beans components, forward the user to another page, or generate HTML for the Java plug-in.<\/p>\n<p>Syntax:<\/p>\n<p><strong>Give some of the JSP action names?<\/strong><\/p>\n<p>Ans: There are some frequently used jsp actions. They are<\/p>\n<p>jsp:include<br \/>\njsp:forward<br \/>\njsp:useBean<br \/>\njsp:body<br \/>\njsp:attribute<\/p>\n<table style=\"background: #d9dde2;\">\n<tbody>\n<tr>\n<td style=\"border: 1px solid black;\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a href=\"https:\/\/www.gologica.com\/course\/jsp\/\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-3184\" src=\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP-Course-IMG-1.png\" alt=\"JSP Training\" width=\"850\" height=\"200\" srcset=\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP-Course-IMG-1.png 850w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP-Course-IMG-1-460x108.png 460w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP-Course-IMG-1-768x181.png 768w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP-Course-IMG-1-100x24.png 100w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP-Course-IMG-1-600x141.png 600w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP-Course-IMG-1-120x28.png 120w, https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP-Course-IMG-1-310x73.png 310w\" sizes=\"(max-width: 850px) 100vw, 850px\" \/><\/a><\/p>\n<p><strong>What is page directive?<\/strong><\/p>\n<p>The page directive is used to provide instructions to the container that pertain to the current JSP page. You may code page directives anywhere in your JSP page.<\/p>\n<p><strong>What are the various attributes of page directive?<\/strong><\/p>\n<p>Ans: The following are the page attributes:<\/p>\n<p>\u2022 language<br \/>\n\u2022 extends<br \/>\n\u2022 import<br \/>\n\u2022 session<br \/>\n\u2022 isThreadSafe<br \/>\n\u2022 errorPage<br \/>\n\u2022 contentType<br \/>\n\u2022 autoFlush<\/p>\n<p><strong>What is include directive?<\/strong><\/p>\n<p>They include directive is used to includes a file during the translation phase. This directive tells the container to merge the content of other external files with the current JSP during the translation phase.<\/p>\n<p>Syntax: &lt;%@ include file=&#8221;relative url&#8221;&gt;<\/p>\n<p><strong>What is session Object?<\/strong><\/p>\n<p>The session object is an instance of javax.servlet.http.HttpSession and is used to track client session between client requests.<\/p>\n<p><strong>Define Filters?<\/strong><br \/>\nJSP Filters are java classes that can be used in JSP programming for the following purpose:<br \/>\n\u2022 To manipulate responses from server before they are sent back to the client<br \/>\n\u2022 To intercept requests from a client before they access a resource at back end.<\/p>\n<p><strong>What are cookies?<\/strong><br \/>\nCookies are text files stored on the client computer and they are kept for various information tracking purpose.<\/p>\n<p><strong>What is JSTL?<\/strong><br \/>\nThe Java Server Pages Standard Tag Library(JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications. It supports for common,structural tasks such as iteration and conditionals,tags for manipulating XML documents and SQL tags.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is JSP? JSP stands for Java Server Page, It is a server side technology and it is used to &hellip;<\/p>\n","protected":false},"author":1,"featured_media":2080,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"pmpro_default_level":"","footnotes":""},"categories":[15224],"tags":[],"coauthors":[182],"class_list":["post-1063","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fullstack","pmpro-has-access","user-has-not-earned"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JSP Interview Questions and Answers - GoLogica<\/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:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JSP Interview Questions and Answers - GoLogica\" \/>\n<meta property=\"og:description\" content=\"What is JSP? JSP stands for Java Server Page, It is a server side technology and it is used to &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/\" \/>\n<meta property=\"og:site_name\" content=\"GoLogica\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-23T01:59:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-06T03:12:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png\" \/>\n\t<meta property=\"og:image:width\" content=\"300\" \/>\n\t<meta property=\"og:image:height\" content=\"175\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62\"},\"headline\":\"JSP Interview Questions and Answers\",\"datePublished\":\"2018-08-23T01:59:11+00:00\",\"dateModified\":\"2025-04-06T03:12:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/\"},\"wordCount\":606,\"image\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png\",\"articleSection\":[\"Fullstack\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/\",\"url\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/\",\"name\":\"JSP Interview Questions and Answers - GoLogica\",\"isPartOf\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png\",\"datePublished\":\"2018-08-23T01:59:11+00:00\",\"dateModified\":\"2025-04-06T03:12:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#primaryimage\",\"url\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png\",\"contentUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png\",\"width\":300,\"height\":175,\"caption\":\"Top JSP Interview Questions\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.gologica.com\/elearning\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JSP Interview Questions and Answers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#website\",\"url\":\"https:\/\/www.gologica.com\/elearning\/\",\"name\":\"GoLogica\",\"description\":\"E-Learning Portal\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.gologica.com\/elearning\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/image\/d0ab308492a1bfcbec1a1ce1637996db\",\"url\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg\",\"contentUrl\":\"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.gologica.com\/elearning\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JSP Interview Questions and Answers - GoLogica","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:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/","og_locale":"en_US","og_type":"article","og_title":"JSP Interview Questions and Answers - GoLogica","og_description":"What is JSP? JSP stands for Java Server Page, It is a server side technology and it is used to &hellip;","og_url":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/","og_site_name":"GoLogica","article_published_time":"2018-08-23T01:59:11+00:00","article_modified_time":"2025-04-06T03:12:04+00:00","og_image":[{"width":300,"height":175,"url":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#article","isPartOf":{"@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/"},"author":{"name":"admin","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62"},"headline":"JSP Interview Questions and Answers","datePublished":"2018-08-23T01:59:11+00:00","dateModified":"2025-04-06T03:12:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/"},"wordCount":606,"image":{"@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png","articleSection":["Fullstack"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/","url":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/","name":"JSP Interview Questions and Answers - GoLogica","isPartOf":{"@id":"https:\/\/www.gologica.com\/elearning\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#primaryimage"},"image":{"@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png","datePublished":"2018-08-23T01:59:11+00:00","dateModified":"2025-04-06T03:12:04+00:00","author":{"@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62"},"breadcrumb":{"@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#primaryimage","url":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png","contentUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/uploads\/2018\/08\/JSP.png","width":300,"height":175,"caption":"Top JSP Interview Questions"},{"@type":"BreadcrumbList","@id":"https:\/\/www.gologica.com\/elearning\/jsp-interview-questions-and-answers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gologica.com\/elearning\/"},{"@type":"ListItem","position":2,"name":"JSP Interview Questions and Answers"}]},{"@type":"WebSite","@id":"https:\/\/www.gologica.com\/elearning\/#website","url":"https:\/\/www.gologica.com\/elearning\/","name":"GoLogica","description":"E-Learning Portal","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gologica.com\/elearning\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/61458e59d78b8e05fb57997461069c62","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gologica.com\/elearning\/#\/schema\/person\/image\/d0ab308492a1bfcbec1a1ce1637996db","url":"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg","contentUrl":"https:\/\/www.gologica.com\/elearning\/wp-content\/themes\/wplms\/assets\/images\/avatar.jpg","caption":"admin"},"url":"https:\/\/www.gologica.com\/elearning\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/1063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/comments?post=1063"}],"version-history":[{"count":5,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/1063\/revisions"}],"predecessor-version":[{"id":3185,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/posts\/1063\/revisions\/3185"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/media\/2080"}],"wp:attachment":[{"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/media?parent=1063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/categories?post=1063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/tags?post=1063"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.gologica.com\/elearning\/wp-json\/wp\/v2\/coauthors?post=1063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}