Home Jsp Simple-jsp-example Forward a JSP Page
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Forward a JSP Page

Advertisement
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.

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 9, 2008

Ask Questions?    Discuss: Forward a JSP Page  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com