getRequestDispatcher
public RequestDispatcher getRequestDispatcher(String path)
-
Returns a
RequestDispatcher
object that acts as a wrapper for the resource located at the given path. ARequestDispatcher
object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static.The pathname specified may be relative, although it cannot extend outside the current servlet context. If the path begins with a "/" it is interpreted as relative to the current context root. This method returns
null
if the servlet container cannot return aRequestDispatcher
.The difference between this method and
ServletContext.getRequestDispatcher(java.lang.String)
is that this method can take a relative path. -
-
Parameters:
-
path
- aString
specifying the pathname to the resource. If it is relative, it must be relative against the current servlet.
Returns:
-
a
RequestDispatcher
object that acts as a wrapper for the resource at the specified path, ornull
if the servlet container cannot return aRequestDispatcher
-