☰ See All Chapters |
forward action tag in JSP
The jsp:forward standard action is used to terminate the execution of the current JSP page and pass the control to another resource. You can forward control either to a static resource or a dynamic resource. It may be jsp, html or servlet. The syntax for the jsp:forward action is:
<jsp:forward page="resourceRelativeURL" />
Below syntax is valid to pass parameter along with forwarding.
<jsp:forward page="resourceRelativeURL">
( <jsp:param . . . /> )*
</jsp:forward>
* indicates that there can be zero or more elements in the brackets
Forward action tag example
Project directory structure
one.jsp
<html> <body bgcolor="yellow"> <jsp:forward page="two.jsp" /> Hello from first jsp. </body> </html> |
two.jsp
<html> <body bgcolor="pink">Hello from second jsp. </body> </html> |
Output
All Chapters