getNamedDispatcher is the method as part of the Request interface.For this method you are passing the servlet name(this name you are providing as part of the web.xml(<servlet><servletname>servletname</servlet-name></servlet>
Amit Mohan Tiwari
Greenhorn
Joined: Aug 21, 2006
Posts: 10
posted
0
Hi friends
What I want to know is as follows
1.getNamedDispatcher(String name)
where name is the name of the servlet given in deployment descriptor under <servlet-name> element and in deployment descriptor under <servlet-class> element we are given the name of the class of the servlet
2.getRequestDispatcher(String path)
where path is the location of the resources(Servlet,jsp,html etc) which we want to dispatch in our current servlet
SO WHAT I WANT TO ASK IS :
IF THE CASE IS THE ABOVE THEN WHY WE HAD THE NEED OF getNamedDispatcher(String name),because the getRequestDispatcher(String path)solves our purpose
Please be aware that typing with the caps-lock button down is considered yelling in web forums. You're not going to improve the odds of getting a better answer by yelling at people.
with getRequestDispatcher(String) method, you can pass the control to any resource be it static or dynamic.And more over the path has to start with "/" as it is taken with refernce to the root context.
but in case of getNamedDispatcher(String), you can pass only to dynamic resource.