Home

This Chapter
-Chapter 8: The Bean Tag Library
-The write Tag
-The cookie Tag
-The header Tag
-The parameter Tag
-The define Tag
-The page Tag
-The include Tag
-The message Tag
-The resource Tag
-The size Tag
-The struts Tag
-Summary

Table of Contents
-Introduction
-Chapter 1: Model 2 and Struts
-Chapter 2: Input Validation with Action Forms
-Chapter 3: The HTML Tag Library
-Chapter 4: Input Validation and Data Conversion
-Chapter 5: The Validator Plugin
-Chapter 6: The Expression Language
-Chapter 7: JSTL
-Chapter 8: The Bean Tag Library
-Chapter 9: The Logic Tag Library
-Chapter 10: Struts-EL, Nested, selectLabel
-Chapter 11: Message Handling and Internationalization
-Chapter 12: The Tiles Framework
-Chapter 13: Securing Struts Applications
-Chapter 14: The Config Object
-Chapter 15: The Persistence Layer
-Chapter 16: Object Caching
-Chapter 17: File Upload and File Download
-Chapter 18: Paging and Sorting
-Chapter 19: Preventing Double Submits
-Chapter 20: Early HttpSession Invalidation
-Chapter 21: Decorating Request Objects
-Chapter 22: How Struts Works

Previous
Next

 

The include Tag

You use the include tag to read an internal or external resource and store the result in a scoped object. The attributes of the include tag are presented in Table 8.8.

Attribute Description
anchor An optional anchor ("#xxx") to be appended to the generated hyperlink. Specify this value without a # character.
forward The logical name of a forward destination inside the global-forwards element in the Struts configuration file that contains the URL of the resource to be included.
href The absolute URL of the resource to be included.
id A required attribute that specifies the name of the scoped variable that will be created to reference the object that contains the specified Web resource.
page A module-relative URI of the Web application resource to be included.
transaction A value of true indicates that the current transaction control token will be included in the generated URL.

Table 8.8: The include tag’s attributes.

For example, the following include tag reads the footer.jsp page and stores the content in the footer scoped object.

<bean:include id="footer" name="/jsp/footer.jsp"/>

The include tag does not print the resource. To achieve this, you need to use the write tag, such as the following.

<bean:write name="footer"/>

Previous
Next