JSP forward action tag

In this tutorial you will learn about the JSP forward action tag and its application with practical example.

JSP forward action tag

This tag is used to terminates the action of the current page and forwards the request to another page which is bind with forward tag, it may be static page, JSP page, or Java Servlet.

Table Of Contents

Syntax without parameter:

As we discussed in our previous article that param action tag we can use with forward tag and include tag, so let’s see how it will use in forward action tag.

Syntax with param:

Example : Let’s get understand it with simple example, In this example I did not use parameter action , we will do in next example.

 

#index.jsp: In this jsp we will declare our jsp:forward action tag and will set the path in “page” attribute. Check below code of this jsp page.

#forwardedPage.jsp: This jsp page will be appear instead of index.jsp page because we put this page in forward tag, check below code.

Output: So output of above code will look like below image.

13

Example with param action tag : In the below example we will get understand about jsp:forward tag with jsp:param tag.

 

#index.jsp: The same page i have used, apply only jsp:param action tag, check below tag.

#forwardedPage.jsp: In this page we will get our parameter like below code.

Output: The output of the above code will look like below image.

14

In this tutorial we have learn about the JSP forward action tag and its application with practical example. I hope you will like this tutorial.