Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Mock Questions

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A servlet can pass on a request to another resource, such as a servlet, JSP, or HTML Page by either using the include() or forward() method of the RequestDispatcher interface. Which of the following is/are the correct way(s) of creating the requestdispatcher object?
a. Using the ServletConfig object
b. Using the ServletContext
c. Using the HTTPServletRequest
d. Using the HTTPServletResponse
A web server has a web application named “fruits” deployed in it. This application has three servlets mapped under URL patterns /apples, /oranges and /grapes. Without making any further assumptions about the deployment, which of the following will invoke the oranges servlet from this Server?
a. http://host ort/oranges
b. http://host ort/fruits/oranges
c. http://host ort/oranges/index.htm
d. http://www.oranges.com/index.htm
[ June 02, 2003: Message edited by: S. Palanigounder ]
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question 1
If the question asks for 1 correct answer then
b. ServletContext

If the question asks for all possible answers then
b. ServletContext
c. HTTPServletRequest.

This is because the method getRequestDispatcher() belongs to the ServletRequest.

Question 2
My answer is
b
a, c, - will give resource not found since there is no web app context.
b - will call the oranges servlet because /fruits/oranges matches the url pattern /oranges
d - will return the default index page.
yogen
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic