Home Jsp Simple-jsp-example Forward a JSP Page



Forward a JSP Page
Posted on: February 9, 2008 at 12:00 AM
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.

Forward a JSP Page

        

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:

 

 

<jsp:forward page="gotForwardedRequest.jsp"/>

 

<html>
<head><title>Request forwarded here</title></head>
<body>
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>.
</body>
</html>

Output of the Program is given below:

Download this example.

Related Tags for Forward a JSP Page:
cjspidebrowserprocessobjectcontrolservletcontrollersedoutputrequestdisplaythisidresponserowjsrowstowsesseciprocwseildesputsplcebrowsepassasntoutplaytrletjispesobjprowhichsspessespatquestishallgoandrvssrollerrocthsthatdispjeplprocesprndonolo


More Tutorials from this section

Ask Questions?    Discuss: Forward a JSP Page  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.