| < Day Day Up > |
|
The <bean:include /> tag is used to evaluate and retrieve the results of a Web application resource. The tag makes the response data available as an object of type String. The tag functions much like the <jsp:include> standard action, except that the response is stored in a page scoped object attribute, as opposed to being written to the output stream.
The resource being evaluated by the <bean:include /> tag can be identified using three different attributes: forward, href, and page.
The <bean:include /> tag has no body and supports six attributes, described in Table 20.4.
Attribute | Description |
---|---|
id | Specifies the page-level variable used to store the result of the evaluated URI condition. (Required) |
anchor | Specifies an HTML anchor tag that will be added to the generated URI. You do not need to include the # character when identifying the anchor. (Optional) |
forward | Used to name a global <forward /> subelement, which will be used to look up a reference to the application-relative or context-relative URI identified by the <forward /> element's path attribute. (Optional) |
href | Used to include resources external to the hosting application. (Optional) |
page | Used to include the value of an application-relative URI. (Optional) |
transaction | If true, causes the transaction token, if available, to be included in the URI being requested. The default value is false. (Optional) |
Here's an example of how we can use the <bean:include /> tag:
<bean:include page="/navbar.jsp"/>
In this example, the context-relative resource navbar.jsp is evaluated and its response is placed in the page-level attribute navbar. The type of page-level attribute is java.lang.String.
| < Day Day Up > |
|