<div dir="ltr" style="text-align: left;">
<div dir="ltr" style="text-align: left;">
<p>Forward tag in JSP forwards request to another source. Another source can be anything like HTML file, Servlet or anothe JSP file.</p>
<p>The forward action terminates the action of the current page and forwards the request to another resource such as a static page, another JSP page, or a Java Servlet.</p>
<p>General syntex of JSP Forward Tag look like this:<br />
<b>Syntex: </b></p>
<pre class="highlight"><;jsp:forward page="xyz"/>;</pre>
<p><b>JSP Forward Tag Example: </b></p>
<pre class="highlight"><;jsp:forward page="Relative URL" />;</pre>
<p><b>Explanation: </b>As shown above, forward tag in JSP has only one attributes &#8220;page&#8221;.</p>
<p><b>page Attribute:</b> page attribute in JSP Forward Tag specifies the relative path of the source where request is going to be handled. This file can be any html, servlet or jsp file.</p>
<p><b>Example:</b><br />
Let us reuse following two files<br />
<b>(a) header.jsp and </b><br />
<b>(b) index.jsp </b><br />
Following is the content of<b> index.jsp</b> file:</p>
<pre class="highlight"><;html>; 
<;head>; 
<;title>;The include Action Example<;/title>; 
<;/head>; 
<;body>; 
<;center>; 
<;h2>;The include action Example<;/h2>; 
<;jsp:forward page="header.jsp" />; 
<;/center>; 
<;/body>; 
<;/html>; 
</pre>
<p><b>header.jsp</b></p>
<pre class="highlight"><;p>; 
 Today's date: <;%= (new java.util.Date()).toLocaleString()%>; 
<;/p>; 
</pre>
<p>Now let us keep all these files in root directory and try to access <b>index.jsp.</b> This would display result something like as below. Here it discarded content from main page and displayed content from forwarded page only.</p>
<p><i><b>http://localhost:8080/index/index.jsp </b></i></p>
<p> ;</p>
<div class="separator" style="clear: both; text-align: center;"><img src="https://dineshonjava.com/wp-content/uploads/2013/09/3333.png" border="0" /></div>
<p> ;</p>
</div>
<div style="background-color: pink; border-width: thin; text-align: center;"><b><;<;<a href="https://dineshonjava.com/jsp-include-directive/">Previous</a> <;<; || <a href="https://dineshonjava.com/jsp-tutorial-baby-step-to-server-pages/">Index </a>|| >;>;<a href="https://dineshonjava.com/jsp-redirect-example/">Next</a> >;>;</b></div>
</div>
<div class="wp-post-navigation"> 
									 <div class="wp-post-navigation-pre"> 
									 <a href="https://dineshonjava.com/jsp-include-directive/">Previous</a> 
									 </div> 
									 <div class="wp-post-navigation-next"> 
									 <a href="https://dineshonjava.com/jsp-redirect-example/">Next</a> 
									 </div> 
									</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
 $.post('https://dineshonjava.com/wp-admin/admin-ajax.php', {action: 'mts_view_count', id: '342'});
});
</script>
Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…
Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…
Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…
Technology has emerged a lot in the last decade, and now we have artificial intelligence;…
Managing a database is becoming increasingly complex now due to the vast amount of data…
Overview In this article, we will explore Spring Scheduler how we could use it by…