• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Use relative URL for RequestDispatcher

 
Ranch Foreman
Posts: 1904
13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p. 146 of Charles Lyon's book,


Which methods on which interfaces can be used to obtain a RequestDispatcher for a relative URL? (choose two)
...
B. getRequestDispatcher(String) on ServletContext
..
D.getRequestDispatcher(String) on ServletRequest
E.getRequestDispatcher(String) on HttpServletRequest



I think there should be three answers : B,D,E.
But the given answers are only D,E.

According to ServletContext API, the ServletContext.getRequestDispatcher(url).


ServletContext "
The pathname must begin with a / and is interpreted as relative to the current context root



 
Creator of Enthuware JWS+ V6
Posts: 3346
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The pathname must begin with a / and is interpreted as relative to the current context root


This is relative to the current context root but not relative to the current Servlet (from where the requestDispatcher is gotten). That is why B is not correct.
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic