I have a doubt.... Let me explain what I understood, please correct me if I am wrong...
getRequestDispatcher("result.jsp") usually gets the request dispatcher for the JSP page we pass as the arguemtn. And getNamedDispatcher(String) gets us the request dispatcher for of the Servlet with that name we passed as the argument.
Does it mean that getRequestDispatcher() must be used to get a dispatcher for JSP and getNamedDispatcher() must be used to get a dispatcher for Servlet???
Sorry if my question is stupid, I am preparing for the exam and I don't have hands-on exp.
getRequestDispatcher() and getNamedDispatcher() can be used for servlet as well as for jsp file. The only difference is that in case of getRequestDispatcher() we use uri. while in case of getNamedDispatcher() we use value defined in <servlet-name> tag in web.xml file for that particular entry.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database