What is the difference between callling a RequestDispatcher
using ServletRequest and ServletContext?

Answers were Sorted based on User's Feedback



What is the difference between callling a RequestDispatcher using ServletRequest and ServletContext..

Answer / mahesh

We can give relative URL when we use ServletRequest and not
while using ServletContext.

Is This Answer Correct ?    7 Yes 0 No

What is the difference between callling a RequestDispatcher using ServletRequest and ServletContext..

Answer / prachetash

RequestDispatcher rd = request.getRequestDispatcher("result.jsp")

This is relative path, becoz there is no "/" slash.Container looks in same logical path.

RequestDispatcher rd = getServletContext.getRequestDispatcher("/result.jsp")

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Servlets Interview Questions

Whether thread can be used in servlets?

0 Answers  


What is the main purpose of java servlets?

0 Answers  


How do you invoke a Servlet? What is the difference between doPost method and doGet method?

0 Answers  


Which event is fired at the time of session creation and destroy?

0 Answers  


can u give some realtime example in ploymorphism? and inheritance?

11 Answers   SolutionNET,






List out the difference between ServletConfig and ServletContext?

0 Answers  


How do cookies work in servlets?

0 Answers  


How can I share objects across different sessions?

2 Answers   Accenture,


How can we implement a jsp page?

0 Answers  


Servlet Chaining? How do you do the Filtering in Servlets?

6 Answers   HCL,


What do you mean by mime type?

0 Answers  


Hi Friends, Can we make any method thread safe withour synchronized keyword?

2 Answers  


Categories