Response Redirection The set Status method of an





- Slides: 5
Response Redirection: The set. Status() method of an Http. Servlet. Response object can be used to send any HTTP response code to a client. The send. Redirect() method in the Http. Servlet. Response object. This method takes one parameter, a String. The send. Redirect() method transmits a location header to the browser. Shivakumara Tuppad, Asst. Prof. , Dept of MCA, BMSIT
Request Delegation and Request Scope: • Request Delegation refers to the request of a single client passing through many servlets or other resources in a web application. • Request Delegation is available through the javax. servlet. Request. Dispatcher object, which can be obtained by calling any of the following methods of the Servlet. Request object. • get. Request. Dispatcher(java. lang. String path) - Returns the Request. Dispatcher object for the path provided as an argument. Shivakumara Tuppad, Asst. Prof. , Dept of MCA, BMSIT
• get. Named. Dispatcher(java. lang. String name) - Returns the Request. Dispatcher object for the named servlet. The servletname elements of the web. xml file define the valid names. The following methods are provided by a Request. Dispatcher object to include different resources and to forward a request to a different resource. forward(javax. servlet. Servlet. Request, javax. servlet. Servlet. Response) –Delegates a request and response to the resource of the Request. Dispatcher object. A call to the forward() method may be used only if no content is previously sent to a client. After the completion of. Shivakumara the processing of the forward() Tuppad, Asst. Prof. , Dept of method, no further data can MCA, be. BMSIT sent to the client.
include(javax. servlet. Servlet. Request, javax. servlet. Servlet. Response) - Works similar to the forward() method , but has some restrictions. Any number of resources can be included by a servlet by using the include() method. Shivakumara Tuppad, Asst. Prof. , Dept of MCA, BMSIT
Note: These ppts are only for quick understanding, so, refer Syllabus copy and as per your text book follow your studies Shivakumara Tuppad, Asst. Prof. , Dept of MCA, BMSIT