Name
<jsp:forward>
Synopsis
The <jsp:forward>
action passes the request processing
control to another JSP page or servlet in the same web application.
The execution of the current page is terminated, giving the target
resource full control over the request.
If any response content has been buffered when the
<jsp:forward>
action is executed, the buffer
is cleared first. If the response has already been committed (i.e.,
partly sent to the browser), the forwarding fails with an
IllegalStateException
.
The URI path information available through the
implicit request
object is adjusted to reflect the
URI path information for the target resource. All other request
information is left untouched, so the target resource has access to
all the original parameters and headers passed with the request.
Additional parameters can be passed to the target resource through
<jsp:param>
elements in the
<jsp:forward>
element’s
body.
Syntax 1: Without parameters
<jsp:forward page="pageOrContextRelativePath
" />
Syntax 2: With nested <jsp:param> actions
<jsp:forward page="pageOrContextRelativePath
" />
One or more <jsp:param> actions
</jsp:forward>
Attributes
Attribute name |
Java type |
Dynamic value accepted |
Description |
---|---|---|---|
page |
String |
RT expression |
A page-relative or context-relative URI path for the resource to forward to |
Example
<jsp:forward page="list.jsp" />
Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.