Name
RequestDispatcher
Synopsis
Interface Name:
javax.servlet.RequestDispatcher
Superinterface: None
Immediate Subinterfaces: None
Implemented By: None
Availability: Servlet API 2.1 and later
Description
The interface for an object that can internally dispatch requests to
any resource (such as a servlet, HTML file, or JSP file) on the
server. The servlet container creates the
RequestDispatcher object that is then used as a
wrapper around a server resource located at a particular path or
given by a particular name. This interface is intended to wrap
servlets and JSP pages, but a servlet container can create
RequestDispatcher objects to wrap any type of
resource. The dispatching can be used to forward a request to the
resource or to include the content of that resource into the current
response. This class was introduced in Servlet API 2.1.
Interface Declaration
public interface RequestDispatcher {
// Methods
public abstract void forward(ServletRequest req, ServletResponse res)
throws ServletException, java.io.IOException // New in 2.1
public abstract void include(ServletRequest req, ServletResponse res)
throws ServletException, java.io.IOException // New in 2.1
}Methods
forward()
public abstract void forward(ServletRequest req, ServletResponse res) throws ServletException, IOException, IllegalStateException
- Description
Forwards a request from a servlet to another resource on the server. This method allows one servlet to do preliminary processing of a request and another resource to generate ...