Jsp Forward

Prev Tutorial Next Tutorial

Jsp Forward

This action tag is used for forwarding a request from a jsp to another jsp or a servlet or a html.

When use JSP Forward tag

Generally, if a huge logic is required in a jsp then we divide that logic into multiple jsp pages and then we apply forwarding technique.

Note: If destination is a jsp or html then file name is required and if destination is a servlet then url pattern is requied.

Save and Compile jsp program

JSP program must be save with the .jsp extension. And for compile jsp code simply follow step of compilation servlet code.


<jsp:forward page="/srv1"/>
<jsp:forward page="home.jsp"/>
<jsp:forward page="index.html"/>

When a request is forwarded then along-with the request, automatically request parameters send from browser or also forwarded. If you want to attach additional parameters then we use <jsp:param> tag inside <jsp:forward> tag.


<jsp:forward page="home.jsp">
<jsp:param name="p1" value="10"/>
<jsp:param name="p2" value="20"/>

Prev Tutorial Next Tutorial

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements