Transferring Control to Another Web Component
The mechanism for transferring control to another web component from a JSP pageuses the functionality provided by the Java Servlet API as described inAccessing a Session. Youaccess this functionality from a JSP page by using thejsp:forward element:
<jsp:forward page="/main.jsp" />
Note that if any data has already been returned to a client,thejsp:forward element will fail with anIllegalStateException.
jsp:param Element
When aninclude orforward element is invoked, the original request object isprovided to the target page. If you wish to provide additional data tothat page, you can append parameters to the request object by using thejsp:param element:
<jsp:include page="..." > <jsp:param name="param1" value="value1"/></jsp:include>
Whenjsp:include orjsp:forward is executed, the included page or forwarded page willsee the original request object, with the original parameters augmented with the newparameters and new values taking precedence over existing values when applicable. For example, ifthe request has a parameterA=foo and a parameterA=bar is specifiedfor forward, the forwarded request will haveA=bar,foo. Note that the newparameter has precedence.
The scope of the new parameters is thejsp:include orjsp:forward call;that is, in the case of anjsp:include the new parameters (and values)will not apply after the include.