Java Reference
In-Depth Information
To see this in action, open the included header.jsp and make some changes to it. Now reload
the EmployeeInfo.jsp . Your changes should take effect immediately. This is the difference
between the include directive and the <jsp:include> standard action. To propagate changes
using the include directive, you would have needed to restart the JSP engine. Using the
<jsp:include> directive relieves you of this need.
The <jsp:forward> Standard Action
The <jsp:forward> action enables the JSP engine to dispatch, at runtime, the current request
to a static resource, servlet, or another JSP. The appearance of this action effectively terminates
the execution of the current page.
N OTE
A <jsp:forward> action can contain <jsp:param> sub-attributes. These sub-attributes
provide values for parameters in the request to be used for forwarding.
The syntax of the <jsp:forward> action is as follows:
<jsp:forward page=” relativeURLspec ” />
and
<jsp:forward page= relativeURLspec ”>
<jsp:param .../>
</jsp:forward>
Table 16.7 contains the attribute and its description for the <jsp:forward> action.
T ABLE 16.7
The Attribute for the <jsp:forward> Action
Attribute
Definition
This attribute represents the relative URL of the target of the forward.
page
The <jsp:forward> standard action is commonly used as a conditional in a JSP. In our example,
you will get the company id from the request and, based on it, you will use the <jsp:forward>
to go to the employee's particular company page. Listing 16.5 contains the JSP that does this.
Search WWH ::




Custom Search