{"id":1474,"date":"2011-02-11T01:50:54","date_gmt":"2011-02-10T20:20:54","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=1474"},"modified":"2011-02-11T01:50:54","modified_gmt":"2011-02-10T20:20:54","slug":"difference-in-servletrequest-getrequestdispather-and-servletcontext-getrequestdispatcher-in-servlet","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/java\/servlet\/difference-in-servletrequest-getrequestdispather-and-servletcontext-getrequestdispatcher-in-servlet\/","title":{"rendered":"difference in ServletRequest.getRequestDispather() and ServletContext.getRequestDispatcher() in Servlet"},"content":{"rendered":"<p><strong>Servletrequest.getRequestDispatcher(&#8220;url&#8221;\u009d)<\/strong> means the dispatch is <strong>relative <\/strong>to the current HTTP request.<br \/>\nExample code:  <\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\"> \nRequestDispatcher reqDispObj = request.getRequestDispatcher(&quot;\/login.jsp&quot;);\n<\/pre>\n<p><strong>getServletContext().getRequestDispatcher(&#8220;url&#8221;\u009d)<\/strong> means the dispatch is <strong>relative to the root <\/strong>of the ServletContext.<br \/>\nExample code:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\nRequestDispatcher reqDispObj = getServletContext().getRequestDispatcher(&quot;\/testApp\/login.jsp&quot;);\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>What is difference in ServletRequest.getRequestDispather() and ServletContext.getRequestDispatcher() in Servlet<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11],"tags":[125],"class_list":["post-1474","post","type-post","status-publish","format-standard","hentry","category-servlet","tag-j2ee"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1467,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/servlet\/difference-between-servletcontext-and-servletconfig\/","url_meta":{"origin":1474,"position":0},"title":"Difference between servletContext and ServletConfig","author":"Jitendra","date":"February 8, 2011","format":false,"excerpt":"What is difference between servletContext and ServletConfig?","rel":"","context":"In &quot;Servlet&quot;","block_context":{"text":"Servlet","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/servlet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1501,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/servlet\/difference-in-sendredirect-and-requestdispatcher-in-servlet\/","url_meta":{"origin":1474,"position":1},"title":"Difference in SendRedirect() and RequestDispatcher() in Servlet","author":"Jitendra","date":"February 13, 2011","format":false,"excerpt":"difference in SendRedirect() and RequestDispatcher() in Servlet","rel":"","context":"In &quot;Servlet&quot;","block_context":{"text":"Servlet","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/servlet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1439,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/difference-in-httpservlet-and-genericservlet\/","url_meta":{"origin":1474,"position":2},"title":"Difference in HttpServlet and GenericServlet","author":"Jitendra","date":"February 4, 2011","format":false,"excerpt":"What is the basic Difference in HttpServlet and GenericServlet","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1494,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/servlet\/life-cycle-of-servlet\/","url_meta":{"origin":1474,"position":3},"title":"Life Cycle of Servlet","author":"Jitendra","date":"February 12, 2011","format":false,"excerpt":"Explain Life Cycle of Servlet","rel":"","context":"In &quot;Servlet&quot;","block_context":{"text":"Servlet","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/servlet\/"},"img":{"alt_text":"Servlet Life Cycle","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/02\/Servlet-Life-Cycle.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1479,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/servlet\/example-to-override-the-init-method-of-the-servlet\/","url_meta":{"origin":1474,"position":4},"title":"Example to Override the init() method of the servlet","author":"Jitendra","date":"February 11, 2011","format":false,"excerpt":"Example to Override the init() method of the servlet","rel":"","context":"In &quot;Servlet&quot;","block_context":{"text":"Servlet","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/servlet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1959,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/servlet\/create-servlet-using-annotation\/","url_meta":{"origin":1474,"position":5},"title":"Create Servlet using Annotation &#8211; Servlet 3.0","author":"Jitendra","date":"April 13, 2011","format":false,"excerpt":"Create the Servlet without any deployment descriptor. Using Annotations","rel":"","context":"In &quot;Servlet&quot;","block_context":{"text":"Servlet","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/servlet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/1474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=1474"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/1474\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=1474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=1474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=1474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}