Java Servlet Programming, 2nd Edition > A. Servlet API Quick Reference > RequestDispatcher |
SynopsisInterface Name: javax.servlet.RequestDispatcher Superinterface: None Immediate Subinterfaces: None Implemented By: None Availability: Servlet API 2.1 and later DescriptionThe 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 Declarationpublic 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 } Methodsforward()public abstract void forward(ServletRequest req, ServletResponse res) throws ServletException, IOException, IllegalStateException
include()public abstract void include(ServletRequest req, ServletResponse res) throws ServletException, IOException
|