Transferring Control to Another Web Component
The mechanism for transferring control to another web component from a JSP page uses the functionality provided by the Java Servlet API as described in Accessing a Session (page 86). You access this functionality from a JSP page by using the
jsp:forwardelement:Note that if any data has already been returned to a client, the
jsp:forwardelement will fail with anIllegalStateException.jsp:param Element
When an
includeorforwardelement is invoked, the original request object is provided to the target page. If you wish to provide additional data to that page, you can append parameters to the request object by using thejsp:paramelement:When
jsp:includeorjsp:forwardis executed, the included page or forwarded page will see the original request object, with the original parameters augmented with the new parameters and new values taking precedence over existing values when applicable. For example, if the request has a parameterA=fooand a parameterA=baris specified for forward, the forwarded request will haveA=bar,foo. Note that the new parameter has precedence.The scope of the new parameters is the
jsp:includeorjsp:forwardcall; that is, in the case of anjsp:includethe new parameters (and values) will not apply after the include.