JSP Forward action tag

Forward action tag in JSP transfer the control of one JSP page to another JSP with specify URL. Forward also can be static or dynamic as include action. When we use param tags, it is dynamic forward with having values. Static forward is simple forward without having param tags.Forward is used when we need to jump from one page to another if error occur or if work is completed in parent page. E.g we are inserting data in database with using insert statement. After finishing insert, control of page should go to successful insertion of data in database page or failure of insertion go to error page. This can be done forward action tag.

<jsp:forward page="relativeURL | or <%= expression %>" />

e.g

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

 

Leave a Reply

Your email address will not be published. Required fields are marked *