Whenever the request comes from the client or browser then two objects are created by the container, one of request object and the second one is of response object. The request object goes to the controller then the controller decides by which jsp or servlet this request will be processed, then the request object is passed to that jsp or servlet and the output is displayed to the browser by the response object.
Sometimes it happens that the particular request is not be able to performed fully by the jsp or servlet for which the browser has send the request, but it has the reference of the jsp or servlet that can perform the rest of the processing, and in the URL you can see the page to which the request has been forwarded. In this whole process only one request object and response object will do the whole thing.
The code of the program is given below:
<head><title>Request forwarded here</title></head>
This page received a forwarded request from <b>getRequest.jsp</b>,
<br>This page is the output from <b>gotForwardedRequest.jsp</b>,
<br>but the URL is for <b>getRequest.jsp</b>.
Output of the Program is given below:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Forward a JSP Page
Post your Comment