A simple Web-Application demonstrating how to forward a request from one jsp page to another jsp.
1. Create a JSP : index.jsp
2. Create a JSP : welcome.jsp
Output of the program :
As soon as user request for index.jsp page, the request goes to index.jsp and there it finds that it is been forwarded to welcome.jsp by the use of jsp:forward tag along with the necessary parameters with it. The control internally forwards to welcome.jsp and the rendered page of welcome.jsp is visible at the browser. Note : As soon as forward request comes the execution of calling JSP page gets stopped and request gets forwarded to another JSP. Here output shows that the last H1 tag doesn't gets outputted on the browser.
1. Create a JSP : index.jsp
|
2. Create a JSP : welcome.jsp
|
Output of the program :
As soon as user request for index.jsp page, the request goes to index.jsp and there it finds that it is been forwarded to welcome.jsp by the use of jsp:forward tag along with the necessary parameters with it. The control internally forwards to welcome.jsp and the rendered page of welcome.jsp is visible at the browser. Note : As soon as forward request comes the execution of calling JSP page gets stopped and request gets forwarded to another JSP. Here output shows that the last H1 tag doesn't gets outputted on the browser.