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

What happens, when client requests for server object, which is not yet loaded into the memory?

2 Answers  


How will you open a new page after certain interval of time (5 sec), on clicking of a button in an html page?

2 Answers  


Name the different ways of session tracking.

0 Answers  


How printwriter is different from servletoutputstream?

0 Answers  


What is servlet configuration?

0 Answers  






can i call init() method in destroy() method of servlset. ?

5 Answers   IBM,


Which exception is thrown if servlet is not initialized properly?

1 Answers  


How can we upload the file to the server using servlet?

0 Answers  


When jsessionid is created?

0 Answers  


What are the methods in HttpSession and their use?

3 Answers  


What is filter? Can filter be used as request or response?

1 Answers  


How to get the actual path of servlet in server?

0 Answers  


Categories