We are moved to new domain
Click -> www.ehowtonow.com
Sunday, 6 April 2014

Servlet – RequestDispatcher Interface

In this tutorial we are going to see about Servlet RequestDispatcher Interface with example program.
Request Dispatcher
public interface RequestDispatcher

Defines an object that receives requests from the client and sends them to any resource (such as a servlet, HTML file, or JSP file) on the server. The servlet container creates the RequestDispatcher object, which is 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, but a servlet container can create RequestDispatcher objects to wrap any type of resource.

Methods in Request Dispatcher Interface

S.NO
Methods with Description

Example

1 void forward(ServletRequest request, ServletResponse response)
Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server.
Click here
2 void include(ServletRequest request, ServletResponse response)
Includes the content of a resource (servlet, JSP page, HTML file) in the response.
Click here

Fields in Request Dispatcher Interface

S.NO
Fields with Description

1 static final java.lang.String FORWARD_REQUEST_URI
The name of the request attribute under which the original request URI is made available to the target of a forward
2 static final java.lang.String FORWARD_CONTEXT_PATH
The name of the request attribute under which the original context path is made available to the target of a forward
3 static final java.lang.String FORWARD_PATH_INFO
The name of the request attribute under which the original path info is made available to the target of a forward
4 static final java.lang.String FORWARD_SERVLET_PATH
The name of the request attribute under which the original servlet path is made available to the target of a forward
5 static final java.lang.String FORWARD_QUERY_STRING
The name of the request attribute under which the original query string is made available to the target of a forward
6 static final java.lang.String INCLUDE_REQUEST_URI
The name of the request attribute under which the request URI of the target of an include is stored
7 static final java.lang.String INCLUDE_CONTEXT_PATH
The name of the request attribute under which the context path of the target of an include is stored
8 static final java.lang.String INCLUDE_PATH_INFO
The name of the request attribute under which the path info of the target of an include is stored
9 static final java.lang.String INCLUDE_SERVLET_PATH
The name of the request attribute under which the servlet path of the target of an include is stored
10 static final java.lang.String INCLUDE_QUERY_STRING
The name of the request attribute under which the query string of the target of an include is stored
11 static final java.lang.String ERROR_EXCEPTION
The name of the request attribute under which the exception object is propagated during an error dispatch
12 static final java.lang.String ERROR_EXCEPTION_TYPE
The name of the request attribute under which the type of the exception object is propagated during an error dispatch
13 static final java.lang.String ERROR_MESSAGE
The name of the request attribute under which the exception message is propagated during an error dispatch
14 static final java.lang.String ERROR_REQUEST_URI
The name of the request attribute under which the request URI whose processing caused the error is propagated during an error dispatch
15 static final java.lang.String ERROR_SERVLET_NAME
The name of the request attribute under which the name of the servlet in which the error occurred is propagated during an error dispatch
16 static final java.lang.String ERROR_STATUS_CODE
The name of the request attribute under which the response status is propagated during an error dispatch

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: Servlet – RequestDispatcher Interface Rating: 5 Reviewed By: eHowToNow