Set - 3

Question 6 :

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

Answer :

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


Question 7 :

Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?

Answer :

Since ServletRequest has the current request path to evaluae the relative path while ServletContext does not.