Question
What is the benefit of using the servletContext as opposed the request in order to obtain a requestDispatcher?
servletContext.getRequestDispatcher(dispatchPath)
and using
argRequest.getRequestDispatcher(dispatchPath)
Solution
It's there in the javadocs in black and white
The difference between this method and ServletContext.getRequestDispatcher(java.lang.String) is that this method can take a relative path.
OTHER TIPS
When you call getRequestDispatcher
from ServletContext
, you need to provide an absolute path, but for ServletRequest
objects, you need to provide a relative path.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow