• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Request Dispatcher

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why we use RequesDisptcher getNamedDispatcher(String name)

can anyone give the full description of getNamedDispatcher(String name)
 
Ranch Hand
Posts: 390
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I googled out this; think it answers your question.

http://java.boot.by/wcd-guide/ch03s05.html
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

RequestDispatcher rd1=servletContext.getrequestDispatcher("/servleturlpattern");


Here you are passing the url pattern of the servlet.

RequestDispatcher rd1=Request.getNamedDispatcher("servletname");

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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


Thanks
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Amit,

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.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

regards
Naresh Waswani

9986461501
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic