• 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

getNamedDispatcher ????

 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know when or why i schould use a getrequestdispatcher, but what is the getNamedDispatcher fore ???

Both takes a string, and return a RequestDispatcher ??

Frank
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is also one way of getting the RequestDispatcher, instead of giving the path we give the name of servlet.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You give a name to your servlets, in web.xml, in the servlet-name tag. You can then use this name and pass it to getNamedDispatcher.
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey this sounds cool
i too was confused about this

now i got it

hope the spec has more to add on it !!!
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey this sounds cool
i too was confused about this

now i got it

hope the spec has more to add on it !!!
 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

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.

Thank you
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic