All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface javax.servlet.RequestDispatcher

public interface RequestDispatcher
Defines a object which serves as a wrapper around a server resource accessible via a particular URL path. This interface is primary used to access the functionality of one servlet from another.

This class is not implemented by servlet programmers, but by servlet engine authors.

See Also:
getRequestDispatcher

Method Index

 o forward(ServletRequest, ServletResponse)
Used for forwarding a request from one servlet to another component within the server.
 o include(ServletRequest, ServletResponse)
Includes the generated response from the target resource into the current response.

Methods

 o forward
 public abstract void forward(ServletRequest request,
                              ServletResponse response) throws ServletException, IOException
Used for forwarding a request from one servlet to another component within the server. This method is useful in cases where one servlet does preliminary processing of a request and wants to programmatically hand off the generation of a response to another servlet.

This method may not be used if the calling servlet has already output any response to the client.

Parameters:
request - the client's request on the servlet
response - the client's response from the servlet
Throws: ServletException
if a servlet exception is thrown by the target servlet
Throws: IOException
if an I/O Exception occurs
Throws: IllegalStateException
if the ServletOutputStream or a writer had allready been obtained from the response object
 o include
 public abstract void include(ServletRequest request,
                              ServletResponse response) throws ServletException, IOException
Includes the generated response from the target resource into the current response. This method allows for programmatic server side includes.

The called servlet (or other resource) will only be able to have access to the PrintWriter or OutputStream of the given request. No headers may be set by the called resource. Any methods that require access to response headers to properly function, such as HttpServletRequest.getSession(), may not function properly when used by a included resource.

Parameters:
request - the client's request on the servlet
response - the client's response from the servlet
Throws: ServletException
if a servlet exception is thrown by the target servlet
Throws: IOException
if the ServletOutputStream or a writer had already been obtained from the response object

All Packages  Class Hierarchy  This Package  Previous  Next  Index